* Implemented overloaded variant of fileage function

git-svn-id: trunk@21867 -
This commit is contained in:
michael 2012-07-11 10:42:23 +00:00
parent 597483610b
commit 789a6452c9
2 changed files with 21 additions and 1 deletions

View File

@ -111,4 +111,4 @@ Function FileIsReadOnly(const FileName: String): Boolean;
Function GetFileHandle(var f : File):THandle;
Function GetFileHandle(var f : Text):THandle;
function FileAge(const FileName: string; out FileDateTime: TDateTime; FollowLink: Boolean = True): Boolean;

View File

@ -155,6 +155,25 @@
temp.free;
end;
function FileAge(const FileName: string; out FileDateTime: TDateTime; FollowLink: Boolean = True): Boolean;
Var
Info : TSearchRec;
A : Integer;
begin
for A:=1 to Length(FileName) do
If (FileName[A] in ['?','*']) then
Exit(False);
A:=0;
if Not FollowLink then
A:=A or faSymLink;
Result:=FindFirst(FileName,A,Info)=0;
If Result then
FileDateTime:=FileDatetoDateTime (Info.Time);
FindClose(Info);
end;
{ Interfaces support }
{$i sysuintf.inc}
@ -761,3 +780,4 @@ begin
If Assigned(OnBeep) then
OnBeep;
end;