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:
@@ -772,7 +772,7 @@ bool wxFileName::DirExists() const
|
|||||||
if ( !ShouldFollowLink() )
|
if ( !ShouldFollowLink() )
|
||||||
flags |= wxFILE_EXISTS_NO_FOLLOW;
|
flags |= wxFILE_EXISTS_NO_FOLLOW;
|
||||||
|
|
||||||
return Exists(GetFullPath(), flags);
|
return Exists(GetPath(), flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
@@ -677,7 +677,13 @@ void FileNameTestCase::TestExists()
|
|||||||
CPPUNIT_ASSERT( !fn.Exists(wxFILE_EXISTS_DIR) );
|
CPPUNIT_ASSERT( !fn.Exists(wxFILE_EXISTS_DIR) );
|
||||||
CPPUNIT_ASSERT( fn.Exists() );
|
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.FileExists() );
|
||||||
CPPUNIT_ASSERT( dirTemp.DirExists() );
|
CPPUNIT_ASSERT( dirTemp.DirExists() );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user