summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils/batchcmds.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-14 23:20:28 +0800
committerruki <[email protected]>2023-11-14 23:20:28 +0800
commitf070b5c9e770199d6fd5de9f696b4894238c6b58 (patch)
treeb74e1d129be1183e0bb484c874f07d2d4fe84ce2 /xmake/modules/private/utils/batchcmds.lua
parent661940b67e586377a362dd956b699244aa3165ec (diff)
add icon file
Diffstat (limited to 'xmake/modules/private/utils/batchcmds.lua')
-rw-r--r--xmake/modules/private/utils/batchcmds.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/xmake/modules/private/utils/batchcmds.lua b/xmake/modules/private/utils/batchcmds.lua
index 6edd1d8f3..347b40be3 100644
--- a/xmake/modules/private/utils/batchcmds.lua
+++ b/xmake/modules/private/utils/batchcmds.lua
@@ -144,6 +144,14 @@ function _runcmd_rm(cmd, opt)
end
end
+-- run command: os.rmdir
+function _runcmd_rmdir(cmd, opt)
+ local dir = cmd.dir
+ if not opt.dryrun and os.isdir(dir) then
+ os.tryrm(dir)
+ end
+end
+
-- run command: os.cp
function _runcmd_cp(cmd, opt)
if not opt.dryrun then
@@ -178,6 +186,7 @@ function _runcmd(cmd, opt)
execv = _runcmd_execv,
vexecv = _runcmd_vexecv,
mkdir = _runcmd_mkdir,
+ rmdir = _runcmd_rmdir,
cd = _runcmd_cd,
rm = _runcmd_rm,
cp = _runcmd_cp,
@@ -333,6 +342,11 @@ function batchcmds:mkdir(dir)
table.insert(self:cmds(), {kind = "mkdir", dir = dir})
end
+-- add command: os.rmdir
+function batchcmds:rmdir(dir)
+ table.insert(self:cmds(), {kind = "rmdir", dir = dir})
+end
+
-- add command: os.rm
function batchcmds:rm(filepath)
table.insert(self:cmds(), {kind = "rm", filepath = filepath})