]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed wxDirExists implementation for OS/2.
authorStefan Neis <Stefan.Neis@t-online.de>
Sun, 11 Dec 2005 15:25:02 +0000 (15:25 +0000)
committerStefan Neis <Stefan.Neis@t-online.de>
Sun, 11 Dec 2005 15:25:02 +0000 (15:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36366 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/filefn.cpp

index c4fe245958c72086863168e567833dd9f1bdccc7..84ebf76d347f062e0b60a00edc836bc9b250da0f 100644 (file)
@@ -1237,7 +1237,13 @@ bool wxDirExists(const wxChar *pszPathName)
 
     return (ret != (DWORD)-1) && (ret & FILE_ATTRIBUTE_DIRECTORY);
 #elif defined(__OS2__)
-    return (bool)(::DosSetCurrentDir((PSZ)(WXSTRINGCAST strPath)));
+    FILESTATUS3 Info = {{0}};
+    APIRET rc = ::DosQueryPathInfo((PSZ)(WXSTRINGCAST strPath), FIL_STANDARD,
+                                   (void*) &Info, sizeof(FILESTATUS3));
+
+    return ((rc == NO_ERROR) && (Info.attrFile & FILE_DIRECTORY)) ||
+      (rc == ERROR_SHARING_VIOLATION);
+    // If we got a sharing violation, there must be something with this name.
 #else // !__WIN32__
 
     wxStructStat st;