diff --git a/src/common/filename.cpp b/src/common/filename.cpp index 474f7fa1c1..51d8953974 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -1518,10 +1518,13 @@ bool wxFileName::Normalize(int flags, continue; } - else // Normal case, go one step up. + else // Normal case, go one step up unless it's .. as well. { - m_dirs.pop_back(); - continue; + if (m_dirs.back() != wxT("..") ) + { + m_dirs.pop_back(); + continue; + } } } } diff --git a/tests/filename/filenametest.cpp b/tests/filename/filenametest.cpp index 1db0edc52d..12d2d571d7 100644 --- a/tests/filename/filenametest.cpp +++ b/tests/filename/filenametest.cpp @@ -355,6 +355,7 @@ void FileNameTestCase::TestNormalize() { "b/../bar", wxPATH_NORM_DOTS, "bar", 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 // when it is the first character in the file name