diff options
| -rw-r--r-- | xmake/actions/uninstall/main.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/xmake/actions/uninstall/main.lua b/xmake/actions/uninstall/main.lua index a7cfec3db..2b25a058d 100644 --- a/xmake/actions/uninstall/main.lua +++ b/xmake/actions/uninstall/main.lua @@ -26,6 +26,7 @@ import("core.base.option") import("core.project.task") import("core.platform.platform") +import("core.base.privilege") import("uninstall") -- main @@ -57,6 +58,28 @@ function main() -- failed or not permission? request administrator permission and uninstall it again function (errors) + -- try get privilege + if privilege.get() then + local ok = try + { + function () + -- uninstall target + uninstall.uninstall(targetname) + + -- trace + cprint("${bright}uninstall ok!${clear}${ok_hand}") + + -- ok + return true + end + } + + -- release privilege + privilege.store() + + if ok then return end + end + -- show tips cprint("${bright red}error: ${default red}failed to uninstall, may permission denied!") |
