mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 23:39:31 +02:00
+ Added missing FileSetDate call
git-svn-id: trunk@403 -
This commit is contained in:
parent
a3ff4850f7
commit
d2d33c03fb
@ -83,6 +83,7 @@ Function FindNext (Var Rslt : TSearchRec) : Longint;
|
||||
Procedure FindClose (Var F : TSearchrec);
|
||||
Function FileGetDate (Handle : Longint) : Longint;
|
||||
Function FileSetDate (Handle,Age : Longint) : Longint;
|
||||
Function FileSetDate (Const FileName : String;Age : Longint) : Longint;
|
||||
Function FileGetAttr (Const FileName : String) : Longint;
|
||||
Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
|
||||
Function DeleteFile (Const FileName : String) : Boolean;
|
||||
|
@ -54,6 +54,25 @@
|
||||
{$endif OS_FILEISREADONLY}
|
||||
|
||||
|
||||
{$ifndef OS_FILESETDATEBYNAME}
|
||||
Function FileSetDate (Const FileName : String;Age : Longint) : Longint;
|
||||
|
||||
Var
|
||||
fd : longint;
|
||||
|
||||
begin
|
||||
fd:=FileOpen(FileName,fmOpenRead);
|
||||
If (Fd>=0) then
|
||||
try
|
||||
Result:=FileSetDate(fd,Age);
|
||||
finally
|
||||
FileClose(fd);
|
||||
end
|
||||
else
|
||||
Result:=Fd;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
{ Read String Handling functions implementation }
|
||||
{$i sysstr.inc}
|
||||
|
||||
|
@ -20,6 +20,7 @@ interface
|
||||
{ force ansistrings }
|
||||
{$H+}
|
||||
|
||||
{$DEFINE OS_FILESETDATEBYNAME}
|
||||
{$DEFINE HAS_SLEEP}
|
||||
{$DEFINE HAS_OSERROR}
|
||||
{$DEFINE HAS_OSCONFIG}
|
||||
@ -646,6 +647,19 @@ begin
|
||||
Result := fpAccess(PChar(FileName),W_OK)<>0;
|
||||
end;
|
||||
|
||||
Function FileSetDate (Const FileName : String;Age : Longint) : Longint;
|
||||
|
||||
var
|
||||
t: TUTimBuf;
|
||||
|
||||
begin
|
||||
Result := 0;
|
||||
t.actime := Age;
|
||||
t.modtime := Age;
|
||||
if fputime(PChar(FileName), @t) = -1 then
|
||||
Result := fpgeterrno;
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
Disk Functions
|
||||
****************************************************************************}
|
||||
@ -1023,6 +1037,8 @@ begin
|
||||
Result:=fpgetErrNo;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{ ---------------------------------------------------------------------
|
||||
Application config files
|
||||
---------------------------------------------------------------------}
|
||||
|
Loading…
Reference in New Issue
Block a user