summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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