From 7f7a4518f712f560abe56c57121f9cf1a14303d0 Mon Sep 17 00:00:00 2001 From: Tomas Hajny Date: Thu, 25 Aug 2011 21:34:44 +0000 Subject: [PATCH] * FileExists fixed - wildcards not accepted any longer git-svn-id: trunk@18846 - --- rtl/emx/sysutils.pp | 5 +++-- rtl/go32v2/sysutils.pp | 15 +++++---------- rtl/os2/sysutils.pp | 14 +++++++------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/rtl/emx/sysutils.pp b/rtl/emx/sysutils.pp index 77dcd1d425..bf0ff820fa 100644 --- a/rtl/emx/sysutils.pp +++ b/rtl/emx/sysutils.pp @@ -642,8 +642,9 @@ begin if FileName = '' then Result := false else - Result := FileGetAttr (ExpandFileName (Directory)) and - faDirectory = faDirectory; + Result := FileGetAttr (ExpandFileName (FileName)) and + (faDirectory or faVolumeID) = 0; +(* Neither VolumeIDs nor directories are files. *) end; diff --git a/rtl/go32v2/sysutils.pp b/rtl/go32v2/sysutils.pp index 083eb43bb1..20df960319 100644 --- a/rtl/go32v2/sysutils.pp +++ b/rtl/go32v2/sysutils.pp @@ -285,18 +285,13 @@ end; Function FileExists (Const FileName : String) : Boolean; -Var - Sr : Searchrec; begin - DOS.FindFirst(FileName,$3f,sr); - if DosError = 0 then - begin - { No volumeid,directory } - Result:=(sr.attr and $18)=0; - Dos.FindClose(sr); - end + if FileName = '' then + Result := false else - Result:=false; + Result := FileGetAttr (ExpandFileName (FileName)) and + (faDirectory or faVolumeID) = 0; +(* Neither VolumeIDs nor directories are files. *) end; diff --git a/rtl/os2/sysutils.pp b/rtl/os2/sysutils.pp index 1209750404..27812d8566 100644 --- a/rtl/os2/sysutils.pp +++ b/rtl/os2/sysutils.pp @@ -612,16 +612,16 @@ end; function FileExists (const FileName: string): boolean; -var - SR: TSearchRec; - RC: longint; begin - FileExists:=False; - if FindFirst (FileName, faAnyFile and not (faDirectory), SR) = 0 - then FileExists := True; - FindClose(SR); + if FileName = '' then + Result := false + else + Result := FileGetAttr (ExpandFileName (FileName)) and + (faDirectory or faVolumeID) = 0; +(* Neither VolumeIDs nor directories are files. *) end; + type TRec = record T, D: word; end;