Browse Source

* fix for buggy FileExists and DirectoryExists

git-svn-id: trunk@2684 -
Tomas Hajny 19 years ago
parent
commit
3114cbe049
1 changed files with 4 additions and 2 deletions
  1. 4 2
      rtl/os2/sysutils.pp

+ 4 - 2
rtl/os2/sysutils.pp

@@ -549,7 +549,8 @@ var
   RC: longint;
   RC: longint;
 begin
 begin
   FileExists:=False;
   FileExists:=False;
-  if FindFirst (FileName, faAnyFile, SR)=0 then FileExists:=True;
+  if FindFirst (FileName, faAnyFile and not (faDirectory), SR) = 0
+    then FileExists := True;
   FindClose(SR);
   FindClose(SR);
 end;
 end;
 
 
@@ -768,7 +769,8 @@ function DirectoryExists (const Directory: string): boolean;
 var
 var
   SR: TSearchRec;
   SR: TSearchRec;
 begin
 begin
-  DirectoryExists:=FindFirst(Directory, faDirectory, SR)=0;
+  DirectoryExists := (FindFirst (Directory, faAnyFile, SR) = 0) and
+                                                (SR.Attr and faDirectory <> 0);
   FindClose(SR);
   FindClose(SR);
 end;
 end;