Hi @all,
Is there in Linux any function to set file time (created/modified)?
I need it to set the file/directory time at unpacking ZIP archives.
In Windows I use the following function:
function SetFileDateTime(FileName: UTF8string; DT: longint): boolean;
var
hDir: THandle;
ftCreation: TFiletime;
begin
{$IFDEF windows}
Result := False;
hDir := CreateFile(PChar(FileName), GENERIC_READ or GENERIC_WRITE,
0, nil, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
if hDir <> INVALID_HANDLE_VALUE then
begin
try
DosDateTimeToFileTime(LongRec(DT).Hi, LongRec(DT).Lo, ftCreation);
Result := SetFileTime(hDir, @ftCreation, @ftCreation, @ftCreation);
finally
CloseHandle(hDir);
end;
end
else
{$ENDIF}
Result := False;
end;
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus