Revert accidental incompatible change to wxFileName::DirExists().

The non-static version tests for the existence of the directory part of the
object only as is explicitly mentioned in the documentation, so do the test on
GetPath() and not GetFullPath() as we did since r72707.

Also add a unit test for this behaviour.

Closes #14771.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72718 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-10-22 15:51:26 +00:00
parent 220dcb1a7f
commit 988f7eec77
2 changed files with 8 additions and 2 deletions

View File

@@ -772,7 +772,7 @@ bool wxFileName::DirExists() const
if ( !ShouldFollowLink() )
flags |= wxFILE_EXISTS_NO_FOLLOW;
return Exists(GetFullPath(), flags);
return Exists(GetPath(), flags);
}
/* static */

View File

@@ -677,7 +677,13 @@ void FileNameTestCase::TestExists()
CPPUNIT_ASSERT( !fn.Exists(wxFILE_EXISTS_DIR) );
CPPUNIT_ASSERT( fn.Exists() );
wxFileName dirTemp(wxFileName::DirName(wxFileName::GetTempDir()));
const wxString& tempdir = wxFileName::GetTempDir();
wxFileName fileInTempDir(tempdir, "bloordyblop");
CPPUNIT_ASSERT( !fileInTempDir.Exists() );
CPPUNIT_ASSERT( fileInTempDir.DirExists() );
wxFileName dirTemp(wxFileName::DirName(tempdir));
CPPUNIT_ASSERT( !dirTemp.FileExists() );
CPPUNIT_ASSERT( dirTemp.DirExists() );