Browse Source

+ Patch from Luiz Américo to fix direxists

git-svn-id: trunk@1334 -
michael 20 years ago
parent
commit
9a1052e1be
1 changed files with 6 additions and 9 deletions
  1. 6 9
      rtl/win32/sysutils.pp

+ 6 - 9
rtl/win32/sysutils.pp

@@ -259,16 +259,13 @@ end;
 
 
 Function DirectoryExists (Const Directory : String) : Boolean;
 Function DirectoryExists (Const Directory : String) : Boolean;
 var
 var
-  Handle: THandle;
-  FindData: TWin32FindData;
+  Attr:Dword;
 begin
 begin
-  Result:=False;
-  Handle := FindFirstFile(Pchar(Directory), FindData);
-  If (Handle <> INVALID_HANDLE_VALUE) then
-    begin
-    Result:=((FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY);
-    Windows.FindClose(Handle);
-    end;
+  Attr:=GetFileAttributes(PChar(Directory));
+  if Attr <> $ffffffff then
+    Result:= (Attr and FILE_ATTRIBUTE_DIRECTORY) > 0
+  else
+    Result:=False;
 end;
 end;