From 2cd7025d7b1535171e4728528c99ded61c02cf91 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 11 Jul 2021 14:20:55 +0100 Subject: [PATCH] Replace more uses of wxFileName::Normalize() with MakeAbsolute() Unlike the parent commit, this one does change the behaviour by not applying some normalizations any more, but these changes are correct, i.e. we really don't need to call Normalize(), which expands environment variables in the file names by default, here and just want to make the file paths absolute. In particular, this fixes the problem of mangling file names containing dollar signs in wxFileSystemWatcher. Closes #19214. --- include/wx/fswatcher.h | 2 +- samples/stc/stctest.cpp | 2 +- src/common/stdpbase.cpp | 2 +- utils/wxrc/wxrc.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/wx/fswatcher.h b/include/wx/fswatcher.h index a9a9d8342c..5870c6cb35 100644 --- a/include/wx/fswatcher.h +++ b/include/wx/fswatcher.h @@ -371,7 +371,7 @@ protected: static wxString GetCanonicalPath(const wxFileName& path) { wxFileName path_copy = wxFileName(path); - if ( !path_copy.Normalize() ) + if ( !path_copy.MakeAbsolute() ) { wxFAIL_MSG(wxString::Format(wxASCII_STR("Unable to normalize path '%s'"), path.GetFullPath())); diff --git a/samples/stc/stctest.cpp b/samples/stc/stctest.cpp index 07a8c4a6ad..be31fbacaf 100644 --- a/samples/stc/stctest.cpp +++ b/samples/stc/stctest.cpp @@ -601,7 +601,7 @@ void AppFrame::CreateMenu () void AppFrame::FileOpen (wxString fname) { - wxFileName w(fname); w.Normalize(); fname = w.GetFullPath(); + wxFileName w(fname); w.MakeAbsolute(); fname = w.GetFullPath(); m_edit->LoadFile (fname); m_edit->SelectNone(); } diff --git a/src/common/stdpbase.cpp b/src/common/stdpbase.cpp index 5f5c12a0c8..5ba2a9c80f 100644 --- a/src/common/stdpbase.cpp +++ b/src/common/stdpbase.cpp @@ -78,7 +78,7 @@ wxString wxStandardPathsBase::GetExecutablePath() const return argv0; // better than nothing wxFileName filename(path); - filename.Normalize(); + filename.MakeAbsolute(); return filename.GetFullPath(); } diff --git a/utils/wxrc/wxrc.cpp b/utils/wxrc/wxrc.cpp index d18afcc766..1269d7ce67 100644 --- a/utils/wxrc/wxrc.cpp +++ b/utils/wxrc/wxrc.cpp @@ -338,7 +338,7 @@ void XmlResApp::ParseParams(const wxCmdLineParser& cmdline) if (!parOutput.empty()) { wxFileName fn(parOutput); - fn.Normalize(); + fn.MakeAbsolute(); parOutput = fn.GetFullPath(); parOutputPath = wxPathOnly(parOutput); }