Registriert seit: 11. Aug 2012
Ort: Essen
1.596 Beiträge
Delphi 10.2 Tokyo Professional
|
AW: FileExists mit Wildecard-Support
31. Jul 2022, 18:23
TFilesystem.FindMatchingFile aus meiner dzLib:
https://osdn.net/projects/dzlib-tool...zFileUtils.pas
Delphi-Quellcode:
class function TFileSystem.FindMatchingFile(const _Mask: string; out _Filename: string): TMatchingFileResult;
var
Sr: TSearchRec;
begin
Result := mfNotFound;
if 0 = FindFirst(_Mask, faAnyFile, Sr) then
try
repeat
if (Sr.Name <> '.') and (Sr.Name <> '..') then begin
_Filename := Sr.Name;
if (Sr.Attr and SysUtils.faDirectory) <> 0 then
Result := mfDirectory
else
Result := mfFile;
Exit;
end;
until 0 <> FindNext(Sr);
finally
FindClose(Sr);
end;
end;
Thomas Mueller
|