+ also implemented FileSetDate(FileName) for WASI, via the __wasi_path_filestat_set_times API call

This commit is contained in:
Nikolay Nikolov 2021-10-11 17:51:13 +03:00
parent 94d8c22c6a
commit 068f781c7a

View File

@ -28,6 +28,7 @@ interface
uses
wasiapi;
{$DEFINE OS_FILESETDATEBYNAME}
{$DEFINE HAS_SLEEP}
{$DEFINE HAS_GETTICKCOUNT64}
@ -481,6 +482,24 @@ begin
end;
Function FileSetDate (Const FileName : RawByteString; Age : Int64) : Longint;
var
pr: RawByteString;
fd: __wasi_fd_t;
begin
if not ConvertToFdRelativePath(FileName,fd,pr) then
begin
result:=-1;
exit;
end;
if __wasi_path_filestat_set_times(fd,0,PChar(pr),length(pr),Age*1000000000,Age*1000000000,
__WASI_FSTFLAGS_MTIM or __WASI_FSTFLAGS_ATIM)=__WASI_ERRNO_SUCCESS then
result:=0
else
result:=-1;
end;
Function FileGetAttr (Const FileName : RawByteString) : Longint;
begin
end;