Wie wäre es mit
function DirectoryExists(const Directory: string): Boolean;
bzw.
function FileExists(const FileName: string): Boolean;
Delphi-Quellcode:
function TForm8.GetLastWriteTimeEx_Dictionary(Path: string): TDateTime;
begin
if DirectoryExists(Path) then begin
try
Result := TDirectory.GetLastWriteTime(Path);
except
Result := 0;
end;
end else Result := 0;
end;
Demnach
http://docwiki.embarcadero.com/Libra...ils.TDirectory hat TDirectory 'ne Methode Exists.
class function Exists(const Path: string; FollowLink: Boolean = True): Boolean;
Damit müsste man doch auch vorher abfragen können, ob es das zu prüfende gibt.
Delphi-Quellcode:
function TForm8.GetLastWriteTimeEx_Dictionary(Path: string): TDateTime;
begin
if TDirectory.Exists(Path, False) then begin
try
Result := TDirectory.GetLastWriteTime(Path);
except
Result := 0;
end;
end else Result := 0;
end;