summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-07-15 23:06:50 +0800
committerruki <[email protected]>2024-07-15 23:06:50 +0800
commitc9a3da04855dc7e757b2a95a269c94f64d7ff681 (patch)
treec9fbd40807bb6b99c53e73b772d91ec6b3bc7d12
parent28e075556101cd683f38e010229ea04dad3decf1 (diff)
fix uninstall/remove_files
-rw-r--r--xmake/modules/private/action/clean/remove_files.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/xmake/modules/private/action/clean/remove_files.lua b/xmake/modules/private/action/clean/remove_files.lua
index 3d62c6b78..6609d0766 100644
--- a/xmake/modules/private/action/clean/remove_files.lua
+++ b/xmake/modules/private/action/clean/remove_files.lua
@@ -25,6 +25,9 @@ import("core.base.option")
function main(filedirs, opt)
opt = opt or {}
for _, filedir in ipairs(filedirs) do
- os.tryrm(filedir, {emptydirs = option.get("all") or opt.emptydir})
+ if os.exists(filedir) then
+ -- we cannot use os.tryrm, because we need raise exception if remove failed with `uninstall --admin`
+ os.rm(filedir, {emptydirs = option.get("all") or opt.emptydir})
+ end
end
end