]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed bug with initial path being a root directory on the drive
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 6 Apr 2002 20:54:42 +0000 (20:54 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 6 Apr 2002 20:54:42 +0000 (20:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14973 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/dirdlg.cpp

index 0b8885ffd9143af080111b86f4a9bf2f9d305ba5..7e4d4208471db63bce669d6666300ec8b2cc5b11 100644 (file)
@@ -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('\\');
         }
     }
 }