mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-07 00:18:45 +02:00
* Fixed FileAge and corrected FileGetAttr
This commit is contained in:
parent
49bda42c6c
commit
481ca42ccb
@ -74,12 +74,16 @@ end;
|
|||||||
Function FileAge (Const FileName : String): Longint;
|
Function FileAge (Const FileName : String): Longint;
|
||||||
|
|
||||||
Var Info : Stat;
|
Var Info : Stat;
|
||||||
|
Y,M,D,hh,mm,ss : word;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
If not fstat (FileName,Info) then
|
If not fstat (FileName,Info) then
|
||||||
exit(-1)
|
exit(-1)
|
||||||
else
|
else
|
||||||
Exit (Info.mtime);
|
begin
|
||||||
|
EpochToLocal(info.mtime,y,m,d,hh,mm,ss);
|
||||||
|
Result:=DateTimeToFileDate(EncodeDate(y,m,d)+EncodeTime(hh,mm,ss,0));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -93,6 +97,8 @@ end;
|
|||||||
|
|
||||||
Function LinuxToWinAttr (FN : Char; Const Info : Stat) : Longint;
|
Function LinuxToWinAttr (FN : Char; Const Info : Stat) : Longint;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=0;
|
Result:=0;
|
||||||
If FN='.' then
|
If FN='.' then
|
||||||
@ -101,6 +107,9 @@ begin
|
|||||||
Result:=Result or faDirectory;
|
Result:=Result or faDirectory;
|
||||||
If (Info.Mode and STAT_IWUSR)=0 Then
|
If (Info.Mode and STAT_IWUSR)=0 Then
|
||||||
Result:=Result or faReadOnly;
|
Result:=Result or faReadOnly;
|
||||||
|
If (Info.Mode and
|
||||||
|
(STAT_IFSOCK or STAT_IFBLK or STAT_IFCHR or STAT_IFIFO))<>0 then
|
||||||
|
Result:=Result or faSysFile;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -272,7 +281,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.9 1999-04-08 11:31:01 peter
|
Revision 1.10 1999-05-13 21:54:09 michael
|
||||||
|
* Fixed FileAge and corrected FileGetAttr
|
||||||
|
|
||||||
|
Revision 1.9 1999/04/08 11:31:01 peter
|
||||||
* removed warnings
|
* removed warnings
|
||||||
|
|
||||||
Revision 1.8 1999/02/28 13:18:10 michael
|
Revision 1.8 1999/02/28 13:18:10 michael
|
||||||
|
Loading…
Reference in New Issue
Block a user