-#if defined(__WXPALMOS__)
- return false;
-#elif defined(__WIN32__) && !defined(__WXMICROWIN__)
- // stat() can't cope with network paths
- DWORD ret = ::GetFileAttributes(strPath.t_str());
+bool wxFileSystemObjectExists(const wxString& path, int flags)
+{
+ // Should the existence of file/directory with this name be accepted, i.e.
+ // result in the true return value from this function?
+ const bool acceptFile = (flags & wxFileSystemObject_File) != 0;
+ const bool acceptDir = (flags & wxFileSystemObject_Dir) != 0;
+
+ wxString strPath(path);
+
+#if defined(__WINDOWS__) && !defined(__WXMICROWIN__)
+ if ( acceptDir )
+ {
+ // Ensure that the path doesn't have any trailing separators when
+ // checking for directories.
+ RemoveTrailingSeparatorsFromPath(strPath);
+ }
+
+ // we must use GetFileAttributes() instead of the ANSI C functions because
+ // it can cope with network (UNC) paths unlike them
+ DWORD ret = ::GetFileAttributes(path.t_str());