diff options
| author | ruki <[email protected]> | 2023-11-15 00:43:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-15 00:43:52 +0800 |
| commit | 232d49f245224019a5c69a17702a3c3ad15d467e (patch) | |
| tree | 4bcf5c02f3108c98b85b2253bb2008e4652fafc4 /xmake/modules/private/utils/batchcmds.lua | |
| parent | 6e6b5bb6959d2e0f6b393d881170b3a0eb81fe9d (diff) | |
add tryrm for nsis
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}) |
