From da03e3303f63960ee75b4bfa7d1319f337a728fa Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 6 Apr 2002 20:54:42 +0000 Subject: [PATCH] fixed bug with initial path being a root directory on the drive git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14973 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/dirdlg.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp index 0b8885ffd9..7e4d420847 100644 --- a/src/msw/dirdlg.cpp +++ b/src/msw/dirdlg.cpp @@ -99,14 +99,14 @@ void wxDirDialog::SetPath(const wxString& path) { while ( *(m_path.end() - 1) == _T('\\') ) { - size_t len = m_path.length(); - if ( len == 1 ) - { - // leave '/' alone - break; - } + m_path.erase(m_path.length() - 1); + } - m_path.erase(len - 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('\\'); } } }