Browse Source

+ GetFileTime moved here

pierre 26 years ago
parent
commit
23b2ea2086
1 changed files with 30 additions and 1 deletions
  1. 30 1
      ide/text/wutils.pas

+ 30 - 1
ide/text/wutils.pas

@@ -89,6 +89,8 @@ function ExtOf(const S: string): string;
 function NameOf(const S: string): string;
 function NameAndExtOf(const S: string): string;
 function DirAndNameOf(const S: string): string;
+{ return Dos GetFTime value or -1 if the file does not exist }
+function GetFileTime(const FileName: string): longint;
 
 function EatIO: integer;
 
@@ -311,6 +313,30 @@ begin
   DirAndNameOf:=D+N;
 end;
 
+{ return Dos GetFTime value or -1 if the file does not exist }
+function GetFileTime(const FileName: string): longint;
+var T: longint;
+    f: file;
+    FM: integer;
+begin
+  if FileName='' then
+    T:=-1
+  else
+    begin
+      FM:=FileMode; FileMode:=0;
+      EatIO; DosError:=0;
+      Assign(f,FileName);
+      {$I-}
+      Reset(f);
+      GetFTime(f,T);
+      Close(f);
+      {$I+}
+      if (EatIO<>0) or (DosError<>0) then T:=-1;
+      FileMode:=FM;
+    end;
+  GetFileTime:=T;
+end;
+
 
 function EatIO: integer;
 begin
@@ -448,7 +474,10 @@ end;
 END.
 {
   $Log$
-  Revision 1.8  1999-10-25 16:39:03  pierre
+  Revision 1.9  1999-12-01 16:19:46  pierre
+   + GetFileTime moved here
+
+  Revision 1.8  1999/10/25 16:39:03  pierre
    + GetPChar to avoid nil pointer problems
 
   Revision 1.7  1999/09/13 11:44:00  peter