]> git.saurik.com Git - wxWidgets.git/commitdiff
Revert accidental incompatible change to wxFileName::DirExists().
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Oct 2012 15:51:26 +0000 (15:51 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Oct 2012 15:51:26 +0000 (15:51 +0000)
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

src/common/filename.cpp
tests/filename/filenametest.cpp

index 47cd363d88b74c94107ed02260eaaa90fef24384..b52e989acddd1afc97069b1b659a38194e2b9932 100644 (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 */
index 393858d7d4026ac55268bf8b1b81ce4a6c2a31dd..4864bf78074d89e89404f64e104cdeef23b5cc79 100644 (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() );