diff options
Diffstat (limited to 'xmake/modules/private/utils/batchcmds.lua')
| -rw-r--r-- | xmake/modules/private/utils/batchcmds.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/xmake/modules/private/utils/batchcmds.lua b/xmake/modules/private/utils/batchcmds.lua index 347b40be3..fe518cbec 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.tryrm +function _runcmd_tryrm(cmd, opt) + local filepath = cmd.filepath + if not opt.dryrun then + os.tryrm(filepath) + end +end + -- run command: os.rmdir function _runcmd_rmdir(cmd, opt) local dir = cmd.dir @@ -189,6 +197,7 @@ function _runcmd(cmd, opt) rmdir = _runcmd_rmdir, cd = _runcmd_cd, rm = _runcmd_rm, + tryrm = _runcmd_tryrm, cp = _runcmd_cp, mv = _runcmd_mv, ln = _runcmd_ln @@ -352,6 +361,11 @@ function batchcmds:rm(filepath) table.insert(self:cmds(), {kind = "rm", filepath = filepath}) end +-- add command: os.tryrm +function batchcmds:tryrm(filepath) + table.insert(self:cmds(), {kind = "tryrm", filepath = filepath}) +end + -- add command: os.cp function batchcmds:cp(srcpath, dstpath, opt) table.insert(self:cmds(), {kind = "cp", srcpath = srcpath, dstpath = dstpath, opt = opt}) |
