* FileExists fixed - wildcards not accepted any longer

git-svn-id: trunk@18846 -
This commit is contained in:
Tomas Hajny 2011-08-25 21:34:44 +00:00
parent 8eafefc90f
commit 7f7a4518f7
3 changed files with 15 additions and 19 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;