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

@@ -214,14 +214,20 @@ public:
!m_ext.empty() || m_hasExt;
}
// does the file with this name exists?
// does the file with this name exist?
bool FileExists() const;
static bool FileExists( const wxString &file );
// does the directory with this name exists?
// does the directory with this name exist?
bool DirExists() const;
static bool DirExists( const wxString &dir );
// does anything at all with this name (i.e. file, directory or some
// other file system object such as a device, socket, ...) exist?
bool Exists() const { return Exists(GetFullPath()); }
static bool Exists(const wxString& path);
// checks on most common flags for files/directories;
// more platform-specific features (like e.g. Unix permissions) are not
// available in wxFileName