Fix bug in wxFileName::Normalize() with leading ".."
Don't discard initial ".." when there is more than one such component in the beginning of the path. Closes #18800.
This commit is contained in:
committed by
Vadim Zeitlin
parent
ff87733cd8
commit
a571a13d44
@@ -1518,10 +1518,13 @@ bool wxFileName::Normalize(int flags,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
else // Normal case, go one step up.
|
else // Normal case, go one step up unless it's .. as well.
|
||||||
{
|
{
|
||||||
m_dirs.pop_back();
|
if (m_dirs.back() != wxT("..") )
|
||||||
continue;
|
{
|
||||||
|
m_dirs.pop_back();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -355,6 +355,7 @@ void FileNameTestCase::TestNormalize()
|
|||||||
{ "b/../bar", wxPATH_NORM_DOTS, "bar", wxPATH_UNIX },
|
{ "b/../bar", wxPATH_NORM_DOTS, "bar", wxPATH_UNIX },
|
||||||
{ "c/../../quux", wxPATH_NORM_DOTS, "../quux", wxPATH_UNIX },
|
{ "c/../../quux", wxPATH_NORM_DOTS, "../quux", wxPATH_UNIX },
|
||||||
{ "/c/../../quux", wxPATH_NORM_DOTS, "/quux", wxPATH_UNIX },
|
{ "/c/../../quux", wxPATH_NORM_DOTS, "/quux", wxPATH_UNIX },
|
||||||
|
{ "../../quux", wxPATH_NORM_DOTS, "../../quux", wxPATH_UNIX },
|
||||||
|
|
||||||
// test wxPATH_NORM_TILDE: notice that ~ is only interpreted specially
|
// test wxPATH_NORM_TILDE: notice that ~ is only interpreted specially
|
||||||
// when it is the first character in the file name
|
// when it is the first character in the file name
|
||||||
|
Reference in New Issue
Block a user