+ if ( !StatAny(st, strPath, flags) )
+ return false;
+
+ if ( S_ISREG(st.st_mode) )
+ return acceptFile;
+ if ( S_ISDIR(st.st_mode) )
+ return acceptDir;
+ if ( S_ISLNK(st.st_mode) )
+ {
+ // Take care to not test for "!= 0" here as this would erroneously
+ // return true if only wxFILE_EXISTS_NO_FOLLOW, which is part of
+ // wxFILE_EXISTS_SYMLINK, is set too.
+ return (flags & wxFILE_EXISTS_SYMLINK) == wxFILE_EXISTS_SYMLINK;
+ }
+ if ( S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode) )
+ return (flags & wxFILE_EXISTS_DEVICE) != 0;
+ if ( S_ISFIFO(st.st_mode) )
+ return (flags & wxFILE_EXISTS_FIFO) != 0;
+ if ( S_ISSOCK(st.st_mode) )
+ return (flags & wxFILE_EXISTS_SOCKET) != 0;
+
+ return flags & wxFILE_EXISTS_ANY;
+#endif // Platforms
+}
+
+} // anonymous namespace
+
+bool wxFileName::FileExists() const
+{
+ int flags = wxFILE_EXISTS_REGULAR;
+ if ( !ShouldFollowLink() )
+ flags |= wxFILE_EXISTS_NO_FOLLOW;
+
+ return wxFileSystemObjectExists(GetFullPath(), flags);
+}
+
+/* static */
+bool wxFileName::FileExists( const wxString &filePath )
+{
+ return wxFileSystemObjectExists(filePath, wxFILE_EXISTS_REGULAR);
+}
+
+bool wxFileName::DirExists() const
+{
+ int flags = wxFILE_EXISTS_DIR;
+ if ( !ShouldFollowLink() )
+ flags |= wxFILE_EXISTS_NO_FOLLOW;
+
+ return Exists(GetPath(), flags);
+}
+
+/* static */
+bool wxFileName::DirExists( const wxString &dirPath )
+{
+ return wxFileSystemObjectExists(dirPath, wxFILE_EXISTS_DIR);
+}
+
+bool wxFileName::Exists(int flags) const
+{
+ // Notice that wxFILE_EXISTS_NO_FOLLOW may be specified in the flags even
+ // if our DontFollowLink() hadn't been called and we do honour it then. But
+ // if the user took the care of calling DontFollowLink(), it is always
+ // taken into account.
+ if ( !ShouldFollowLink() )
+ flags |= wxFILE_EXISTS_NO_FOLLOW;