summaryrefslogtreecommitdiff
path: root/xmake/actions/install/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/actions/install/main.lua')
-rw-r--r--xmake/actions/install/main.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/xmake/actions/install/main.lua b/xmake/actions/install/main.lua
index 3ca155789..f9bca9419 100644
--- a/xmake/actions/install/main.lua
+++ b/xmake/actions/install/main.lua
@@ -26,6 +26,7 @@
import("core.base.option")
import("core.project.task")
import("core.platform.platform")
+import("core.base.privilege")
import("install")
-- main
@@ -57,6 +58,28 @@ function main()
-- failed or not permission? request administrator permission and install it again
function (errors)
+ -- try get privilege
+ if privilege.get() then
+ local ok = try
+ {
+ function ()
+ -- install target
+ install.install(targetname or ifelse(option.get("all"), "__all", "__def"))
+
+ -- trace
+ cprint("${bright}install 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}installation failed, may permission denied!")