소스 검색

+ Added missing FileSetDate call

git-svn-id: trunk@403 -
michael 20 년 전
부모
커밋
d2d33c03fb
3개의 변경된 파일36개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      rtl/objpas/sysutils/filutilh.inc
  2. 19 0
      rtl/objpas/sysutils/sysutils.inc
  3. 16 0
      rtl/unix/sysutils.pp

+ 1 - 0
rtl/objpas/sysutils/filutilh.inc

@@ -83,6 +83,7 @@ Function FindNext (Var Rslt : TSearchRec) : Longint;
 Procedure FindClose (Var F : TSearchrec);
 Procedure FindClose (Var F : TSearchrec);
 Function FileGetDate (Handle : Longint) : Longint;
 Function FileGetDate (Handle : Longint) : Longint;
 Function FileSetDate (Handle,Age : Longint) : Longint;
 Function FileSetDate (Handle,Age : Longint) : Longint;
+Function FileSetDate (Const FileName : String;Age : Longint) : Longint;
 Function FileGetAttr (Const FileName : String) : Longint;
 Function FileGetAttr (Const FileName : String) : Longint;
 Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
 Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
 Function DeleteFile (Const FileName : String) : Boolean;
 Function DeleteFile (Const FileName : String) : Boolean;

+ 19 - 0
rtl/objpas/sysutils/sysutils.inc

@@ -54,6 +54,25 @@
   {$endif OS_FILEISREADONLY}
   {$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 }
   { Read String Handling functions implementation }
   {$i sysstr.inc}
   {$i sysstr.inc}
 
 

+ 16 - 0
rtl/unix/sysutils.pp

@@ -20,6 +20,7 @@ interface
 { force ansistrings }
 { force ansistrings }
 {$H+}
 {$H+}
 
 
+{$DEFINE OS_FILESETDATEBYNAME}
 {$DEFINE HAS_SLEEP}
 {$DEFINE HAS_SLEEP}
 {$DEFINE HAS_OSERROR}
 {$DEFINE HAS_OSERROR}
 {$DEFINE HAS_OSCONFIG}
 {$DEFINE HAS_OSCONFIG}
@@ -646,6 +647,19 @@ begin
   Result := fpAccess(PChar(FileName),W_OK)<>0;
   Result := fpAccess(PChar(FileName),W_OK)<>0;
 end;
 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
                               Disk Functions
 ****************************************************************************}
 ****************************************************************************}
@@ -1023,6 +1037,8 @@ begin
   Result:=fpgetErrNo;
   Result:=fpgetErrNo;
 end;
 end;
 
 
+
+
 { ---------------------------------------------------------------------
 { ---------------------------------------------------------------------
     Application config files
     Application config files
   ---------------------------------------------------------------------}
   ---------------------------------------------------------------------}