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.
This commit is contained in:
@@ -371,7 +371,7 @@ protected:
|
|||||||
static wxString GetCanonicalPath(const wxFileName& path)
|
static wxString GetCanonicalPath(const wxFileName& path)
|
||||||
{
|
{
|
||||||
wxFileName path_copy = 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'"),
|
wxFAIL_MSG(wxString::Format(wxASCII_STR("Unable to normalize path '%s'"),
|
||||||
path.GetFullPath()));
|
path.GetFullPath()));
|
||||||
|
@@ -601,7 +601,7 @@ void AppFrame::CreateMenu ()
|
|||||||
|
|
||||||
void AppFrame::FileOpen (wxString fname)
|
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->LoadFile (fname);
|
||||||
m_edit->SelectNone();
|
m_edit->SelectNone();
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,7 @@ wxString wxStandardPathsBase::GetExecutablePath() const
|
|||||||
return argv0; // better than nothing
|
return argv0; // better than nothing
|
||||||
|
|
||||||
wxFileName filename(path);
|
wxFileName filename(path);
|
||||||
filename.Normalize();
|
filename.MakeAbsolute();
|
||||||
return filename.GetFullPath();
|
return filename.GetFullPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -338,7 +338,7 @@ void XmlResApp::ParseParams(const wxCmdLineParser& cmdline)
|
|||||||
if (!parOutput.empty())
|
if (!parOutput.empty())
|
||||||
{
|
{
|
||||||
wxFileName fn(parOutput);
|
wxFileName fn(parOutput);
|
||||||
fn.Normalize();
|
fn.MakeAbsolute();
|
||||||
parOutput = fn.GetFullPath();
|
parOutput = fn.GetFullPath();
|
||||||
parOutputPath = wxPathOnly(parOutput);
|
parOutputPath = wxPathOnly(parOutput);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user