Added wxFileName::Exists().

This function checks for existence of anything with the given name, not
necessarily just a file or a directory.

Extend the unit test to verify that it returns true for /dev/null on Unix
systems.

Closes #953.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70600 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-02-15 15:39:46 +00:00
parent 901504c383
commit 996d3fe3f8
5 changed files with 51 additions and 4 deletions

View File

@@ -657,13 +657,16 @@ void FileNameTestCase::TestExists()
CPPUNIT_ASSERT( fn.FileExists() );
CPPUNIT_ASSERT( !wxFileName::DirExists(fn.GetFullPath()) );
CPPUNIT_ASSERT( fn.Exists() );
wxFileName dirTemp(wxFileName::DirName(wxFileName::GetTempDir()));
CPPUNIT_ASSERT( !dirTemp.FileExists() );
CPPUNIT_ASSERT( dirTemp.DirExists() );
CPPUNIT_ASSERT( dirTemp.Exists() );
#ifdef __UNIX__
CPPUNIT_ASSERT( !wxFileName::FileExists("/dev/null") );
CPPUNIT_ASSERT( !wxFileName::DirExists("/dev/null") );
CPPUNIT_ASSERT( wxFileName::Exists("/dev/null") );
#endif // __UNIX__
}