From 988f7eec77d3a6cbc08980252a0349b3c6be7bf4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 22 Oct 2012 15:51:26 +0000 Subject: [PATCH] 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 --- src/common/filename.cpp | 2 +- tests/filename/filenametest.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/common/filename.cpp b/src/common/filename.cpp index 47cd363d88..b52e989acd 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -772,7 +772,7 @@ bool wxFileName::DirExists() const if ( !ShouldFollowLink() ) flags |= wxFILE_EXISTS_NO_FOLLOW; - return Exists(GetFullPath(), flags); + return Exists(GetPath(), flags); } /* static */ diff --git a/tests/filename/filenametest.cpp b/tests/filename/filenametest.cpp index 393858d7d4..4864bf7807 100644 --- a/tests/filename/filenametest.cpp +++ b/tests/filename/filenametest.cpp @@ -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() ); -- 2.45.2