X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c9f7896861f734ce044ee8601ba2d8a6959c9d9e..8a31648287be0ef976f133de2786b137f1e98340:/src/msw/dirdlg.cpp diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp index d483be374e..9d3b472058 100644 --- a/src/msw/dirdlg.cpp +++ b/src/msw/dirdlg.cpp @@ -100,20 +100,18 @@ void wxDirDialog::SetPath(const wxString& path) m_path = path; // SHBrowseForFolder doesn't like '/'s nor the trailing backslashes - m_path.Replace(_T("/"), _T("\\")); - if ( !m_path.empty() ) + m_path.Replace(wxT("/"), wxT("\\")); + + while ( !m_path.empty() && (*(m_path.end() - 1) == wxT('\\')) ) { - while ( *(m_path.end() - 1) == _T('\\') ) - { - m_path.erase(m_path.length() - 1); - } + m_path.erase(m_path.length() - 1); + } - // but the root drive should have a trailing slash (again, this is just - // the way the native dialog works) - if ( *(m_path.end() - 1) == _T(':') ) - { - m_path += _T('\\'); - } + // but the root drive should have a trailing slash (again, this is just + // the way the native dialog works) + if ( !m_path.empty() && (*(m_path.end() - 1) == wxT(':')) ) + { + m_path += wxT('\\'); } }