summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/os.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-07-19 22:58:13 +0800
committerruki <[email protected]>2024-07-19 22:58:13 +0800
commit835d8e7bc6e5488c5e9fcb88b8fa56f4f4694e38 (patch)
tree5b200030e5a34791738dcacaa1b8f8b2ddf69f66 /xmake/core/sandbox/modules/os.lua
parent5169dfdf8677bad2aaf1b74b73176578f8b390af (diff)
fix os.rm and uninstall modules
Diffstat (limited to 'xmake/core/sandbox/modules/os.lua')
-rw-r--r--xmake/core/sandbox/modules/os.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 9004f66ee..d626d0372 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -102,21 +102,21 @@ function sandbox_os.cp(srcpath, dstpath, opt)
end
-- move file or directory
-function sandbox_os.mv(srcpath, dstpath)
+function sandbox_os.mv(srcpath, dstpath, opt)
assert(srcpath and dstpath)
srcpath = tostring(srcpath)
dstpath = tostring(dstpath)
- local ok, errors = os.mv(vformat(srcpath), vformat(dstpath))
+ local ok, errors = os.mv(vformat(srcpath), vformat(dstpath), opt)
if not ok then
os.raise(errors)
end
end
-- remove files or directories
-function sandbox_os.rm(filepath)
+function sandbox_os.rm(filepath, opt)
assert(filepath)
filepath = tostring(filepath)
- local ok, errors = os.rm(vformat(filepath))
+ local ok, errors = os.rm(vformat(filepath), opt)
if not ok then
os.raise(errors)
end
@@ -161,12 +161,12 @@ function sandbox_os.vrm(filepath, opt)
end
-- link file or directory with the verbose info
-function sandbox_os.vln(srcpath, dstpath)
+function sandbox_os.vln(srcpath, dstpath, opt)
assert(srcpath and dstpath)
if option.get("verbose") then
utils.cprint("${dim}> link %s to %s", srcpath, dstpath)
end
- return sandbox_os.ln(srcpath, dstpath)
+ return sandbox_os.ln(srcpath, dstpath, opt)
end
-- try to copy file or directory
@@ -176,9 +176,9 @@ function sandbox_os.trycp(srcpath, dstpath, opt)
end
-- try to move file or directory
-function sandbox_os.trymv(srcpath, dstpath)
+function sandbox_os.trymv(srcpath, dstpath, opt)
assert(srcpath and dstpath)
- return os.mv(vformat(srcpath), vformat(dstpath))
+ return os.mv(vformat(srcpath), vformat(dstpath), opt)
end
-- try to remove files or directories