[wx-dev] [ wxwindows-Bugs-1566309 ] wxDir::IsOpened() and wxDir::Open() always true
authorRobert Roebling <robert@roebling.de>
Wed, 14 May 2008 09:27:48 +0000 (09:27 +0000)
committerRobert Roebling <robert@roebling.de>
Wed, 14 May 2008 09:27:48 +0000 (09:27 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53592 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/dir.cpp

index 5525d72a611517124ccef1474efe02717e140c28..1bdeb321f7ba2942e53b855339bc96821acc2af1 100644 (file)
@@ -303,9 +303,20 @@ wxDir::wxDir(const wxString& dirname)
 bool wxDir::Open(const wxString& dirname)
 {
     delete M_DIR;
-    m_data = new wxDirData(dirname);
+    
+    // The Unix code does a similar test
+    if (wxDirExists(dirname))
+    {
+        m_data = new wxDirData(dirname);
 
-    return true;
+        return true;
+    }
+    else
+    {
+        m_data = NULL;
+    
+        return false;
+    }
 }
 
 bool wxDir::IsOpened() const