Checked back in the change from rev 1.57 that allows UNC dirs and root dirs to be properly evaluated as to their existence under __WIN32__
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -436,29 +436,14 @@ wxChar *wxGetUserHome(const wxString& user)
|
|||||||
bool wxDirExists(const wxString& dir)
|
bool wxDirExists(const wxString& dir)
|
||||||
{
|
{
|
||||||
#if defined(__WIN32__)
|
#if defined(__WIN32__)
|
||||||
WIN32_FIND_DATA fileInfo;
|
DWORD attribs = GetFileAttributes(dir);
|
||||||
|
return ((attribs != -1) && (attribs & FILE_ATTRIBUTE_DIRECTORY));
|
||||||
#else // Win16
|
#else // Win16
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
struct ffblk fileInfo;
|
struct ffblk fileInfo;
|
||||||
#else
|
#else
|
||||||
struct find_t fileInfo;
|
struct find_t fileInfo;
|
||||||
#endif
|
#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
|
// In Borland findfirst has a different argument
|
||||||
// ordering from _dos_findfirst. But _dos_findfirst
|
// ordering from _dos_findfirst. But _dos_findfirst
|
||||||
// _should_ be ok in both MS and Borland... why not?
|
// _should_ be ok in both MS and Borland... why not?
|
||||||
|
Reference in New Issue
Block a user