summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-11-26 00:03:14 +0800
committerGitHub <[email protected]>2021-11-26 00:03:14 +0800
commite2e14bba2335d9ea0a1de60a318c21efa4d067ef (patch)
tree4adfac2c6865e4d0f1e0438e729f560769368354
parent7d58f6d48d9124e30c3613b4a62d3b940b929335 (diff)
Update main.lua
-rw-r--r--xmake/actions/update/main.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/xmake/actions/update/main.lua b/xmake/actions/update/main.lua
index ed403f47a..7437606fa 100644
--- a/xmake/actions/update/main.lua
+++ b/xmake/actions/update/main.lua
@@ -158,9 +158,17 @@ function _install(sourcedir)
if os.isfile(win_installer_name) then
-- /D sets the default installation directory ($INSTDIR), overriding InstallDir and InstallDirRegKey. It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces. Only absolute paths are supported.
local params = ("/D=" .. os.programdir()):split("%s", { strict = true })
- local testfile = path.join(os.programdir(), "temp-install")
- local no_admin = os.trycp(path.join(os.programdir(), "scripts", "run.vbs"), testfile)
- os.tryrm(testfile)
+ local no_admin = try {function () return winos.registry_query("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\XMake;NoAdmin") end}
+ if no_admin == nil then
+ no_admin = try {function () return winos.registry_query("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\XMake;NoAdmin") end}
+ end
+ if no_admin ~= nil then
+ no_admin = tostring(value):lower() == "true"
+ else
+ local testfile = path.join(os.programdir(), "temp-install")
+ no_admin = os.trycp(path.join(os.programdir(), "scripts", "run.vbs"), testfile)
+ os.tryrm(testfile)
+ end
if no_admin then table.insert(params, 1, "/NOADMIN") end
-- need UAC?
if winos:version():gt("winxp") then