X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ffd10d5da754aa6f22684a0979c71dd69ad557d1..b34039cf55bc7cb87cedf396f60396e2f8fc0d62:/src/mgl/dir.cpp?ds=sidebyside diff --git a/src/mgl/dir.cpp b/src/mgl/dir.cpp index 2fdbfe2d3d..b325114f1c 100644 --- a/src/mgl/dir.cpp +++ b/src/mgl/dir.cpp @@ -116,10 +116,11 @@ bool wxDirData::Read(wxString *filename) PM_findData data; bool matches = FALSE; - // speed up string concatenation in the loop a bit + data.dwSize = sizeof(data); + wxString path = m_dirname; path += wxFILE_SEP_PATH; - path.reserve(path.length() + 255); + path.reserve(path.length() + 255); // speed up string concatenation while ( !matches ) { @@ -195,19 +196,15 @@ wxDir::wxDir(const wxString& dirname) bool wxDir::Open(const wxString& dirname) { delete M_DIR; - m_data = new wxDirData(dirname); - - if ( !M_DIR->IsOk() ) + m_data = NULL; + + if ( !wxDir::Exists(dirname) ) { - wxLogSysError(_("Can not enumerate files in directory '%s'"), - dirname.c_str()); - - delete M_DIR; - m_data = NULL; - + wxLogError(_("Directory '%s' doesn't exist!"), dirname.c_str()); return FALSE; } - + + m_data = new wxDirData(dirname); return TRUE; }