From a7b3747b7beac97be48a3d868355c6dd564853f9 Mon Sep 17 00:00:00 2001 From: nickysn Date: Tue, 22 Jun 2021 23:52:22 +0000 Subject: [PATCH] + implemented Erase() for the WASI target git-svn-id: trunk@49527 - --- rtl/wasi/sysfile.inc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rtl/wasi/sysfile.inc b/rtl/wasi/sysfile.inc index 1761a0b7c4..5313f69d87 100644 --- a/rtl/wasi/sysfile.inc +++ b/rtl/wasi/sysfile.inc @@ -27,8 +27,19 @@ begin end; procedure Do_Erase(p: pchar; pchangeable: boolean); +var + fd: __wasi_fd_t; + pr: PChar; + res: __wasi_errno_t; begin - DebugWriteLn('Do_Erase'); + if not ConvertToFdRelativePath(p,fd,pr) then + exit; + res:=__wasi_path_unlink_file(fd,pr,StrLen(pr)); + if res=__WASI_ERRNO_SUCCESS then + InOutRes:=0 + else + InOutRes:=Errno2InoutRes(res); + FreeMem(pr); end; procedure do_truncate (handle:thandle;fpos:int64);