From c9a3da04855dc7e757b2a95a269c94f64d7ff681 Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 15 Jul 2024 23:06:50 +0800 Subject: fix uninstall/remove_files --- xmake/modules/private/action/clean/remove_files.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.3.1