Browse Source

+ implemented SysUtils.DeleteFile for WASI

Nikolay Nikolov 3 years ago
parent
commit
2a93340bcc
1 changed files with 10 additions and 0 deletions
  1. 10 0
      rtl/wasi/sysutils.pp

+ 10 - 0
rtl/wasi/sysutils.pp

@@ -344,7 +344,17 @@ end;
 
 
 Function DeleteFile (Const FileName : RawByteString) : Boolean;
+var
+  fd: __wasi_fd_t;
+  pr: RawByteString;
+  res: __wasi_errno_t;
 begin
+  if not ConvertToFdRelativePath(FileName,fd,pr) then
+    begin
+      result:=false;
+      exit;
+    end;
+  result:=__wasi_path_unlink_file(fd,PChar(pr),Length(pr))=__WASI_ERRNO_SUCCESS;
 end;