do case normalization after long path one, this fixes the problem with incorrect paths case under Vista (closes 9162)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53732 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1261,11 +1261,6 @@ bool wxFileName::Normalize(int flags,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
|
|
||||||
{
|
|
||||||
dir.MakeLower();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_dirs.Add(dir);
|
m_dirs.Add(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1275,26 +1270,12 @@ bool wxFileName::Normalize(int flags,
|
|||||||
wxString filename;
|
wxString filename;
|
||||||
if (GetShortcutTarget(GetFullPath(format), filename))
|
if (GetShortcutTarget(GetFullPath(format), filename))
|
||||||
{
|
{
|
||||||
// Repeat this since we may now have a new path
|
|
||||||
if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
|
|
||||||
{
|
|
||||||
filename.MakeLower();
|
|
||||||
}
|
|
||||||
m_relative = false;
|
m_relative = false;
|
||||||
Assign(filename);
|
Assign(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
|
|
||||||
{
|
|
||||||
// VZ: expand env vars here too?
|
|
||||||
|
|
||||||
m_volume.MakeLower();
|
|
||||||
m_name.MakeLower();
|
|
||||||
m_ext.MakeLower();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(__WIN32__)
|
#if defined(__WIN32__)
|
||||||
if ( (flags & wxPATH_NORM_LONG) && (format == wxPATH_DOS) )
|
if ( (flags & wxPATH_NORM_LONG) && (format == wxPATH_DOS) )
|
||||||
{
|
{
|
||||||
@@ -1302,6 +1283,22 @@ bool wxFileName::Normalize(int flags,
|
|||||||
}
|
}
|
||||||
#endif // Win32
|
#endif // Win32
|
||||||
|
|
||||||
|
// Change case (this should be kept at the end of the function, to ensure
|
||||||
|
// that the path doesn't change any more after we normalize its case)
|
||||||
|
if ( (flags & wxPATH_NORM_CASE) && !IsCaseSensitive(format) )
|
||||||
|
{
|
||||||
|
m_volume.MakeLower();
|
||||||
|
m_name.MakeLower();
|
||||||
|
m_ext.MakeLower();
|
||||||
|
|
||||||
|
// directory entries must be made lower case as well
|
||||||
|
count = m_dirs.GetCount();
|
||||||
|
for ( size_t i = 0; i < count; i++ )
|
||||||
|
{
|
||||||
|
m_dirs[i].MakeLower();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -317,6 +317,8 @@ void FileNameTestCase::TestNormalize()
|
|||||||
"c:\\program files\\wx", wxPATH_DOS },
|
"c:\\program files\\wx", wxPATH_DOS },
|
||||||
{ "C:/Program Files/wx", wxPATH_NORM_ALL | wxPATH_NORM_CASE,
|
{ "C:/Program Files/wx", wxPATH_NORM_ALL | wxPATH_NORM_CASE,
|
||||||
"c:\\program files\\wx", wxPATH_DOS },
|
"c:\\program files\\wx", wxPATH_DOS },
|
||||||
|
{ "C:\\Users\\zeitlin", wxPATH_NORM_ALL | wxPATH_NORM_CASE,
|
||||||
|
"c:\\users\\zeitlin", wxPATH_DOS },
|
||||||
|
|
||||||
// test wxPATH_NORM_ABSOLUTE
|
// test wxPATH_NORM_ABSOLUTE
|
||||||
{ "a/b/", wxPATH_NORM_ABSOLUTE, cwd + "a/b/", wxPATH_UNIX },
|
{ "a/b/", wxPATH_NORM_ABSOLUTE, cwd + "a/b/", wxPATH_UNIX },
|
||||||
|
|||||||
Reference in New Issue
Block a user