From: Vadim Zeitlin Date: Wed, 20 Dec 2000 14:18:00 +0000 (+0000) Subject: merged fix from 2.2 branch X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/162437627aab82c0b0112aa226ebe9cca3a4cc7a merged fix from 2.2 branch git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8960 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 856c5c9ab9..d547a28b7e 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -436,14 +436,29 @@ wxChar *wxGetUserHome(const wxString& user) bool wxDirExists(const wxString& dir) { #if defined(__WIN32__) - DWORD attribs = GetFileAttributes(dir); - return ((attribs != (DWORD)-1) && (attribs & FILE_ATTRIBUTE_DIRECTORY)); + WIN32_FIND_DATA fileInfo; #else // Win16 #ifdef __BORLANDC__ struct ffblk fileInfo; #else struct find_t fileInfo; #endif +#endif // Win32/16 + +#if defined(__WIN32__) + HANDLE h = ::FindFirstFile(dir, &fileInfo); + + if ( h == INVALID_HANDLE_VALUE ) + { + wxLogLastError(wxT("FindFirstFile")); + + return FALSE; + } + + ::FindClose(h); + + return (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; +#else // Win16 // In Borland findfirst has a different argument // ordering from _dos_findfirst. But _dos_findfirst // _should_ be ok in both MS and Borland... why not?