]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix bug in wxFileName::Exists("/").
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 18 Oct 2012 23:41:08 +0000 (23:41 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 18 Oct 2012 23:41:08 +0000 (23:41 +0000)
Don't remove too many trailing slashes, the lone slash of "/" should remain.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72703 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/filename.cpp

index 349d00b7e35409296bf963232dd96d55bdff9fa7..d21a7e50172bd4da2ad80158665b8ddb610863ad 100644 (file)
@@ -351,7 +351,16 @@ bool DoStatAny(wxStructStat& st, wxString path, const wxFileName* fn)
     // path and not for the last path element itself.
 
     while ( wxEndsWithPathSeparator(path) )
-        path.RemoveLast();
+    {
+        const size_t posLast = path.length() - 1;
+        if ( !posLast )
+        {
+            // Don't turn "/" into empty string.
+            break;
+        }
+
+        path.erase(posLast);
+    }
 
     int ret = !fn || fn->ShouldFollowLink() ? wxStat(path, &st)
                                             : wxLstat(path, &st);