Fix bug in wxFileName::Exists("/").

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
This commit is contained in:
Vadim Zeitlin
2012-10-18 23:41:08 +00:00
parent 88f70d8c0e
commit 1e9b3eff21

View 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);