summaryrefslogtreecommitdiff
path: root/misc/nsis
diff options
context:
space:
mode:
authorbitraid <bitraid@protonmail.ch>2018-10-19 14:11:49 +0300
committerbitraid <bitraid@protonmail.ch>2018-10-19 14:11:49 +0300
commit538d417e698d70cd66beec26fd5c8447b011cbcc (patch)
treed5313766d4e97aa699c4612713f3e7cea441d760 /misc/nsis
parent97e7efba42cc4f40e58e19cf1fc5b41ee6b2462f (diff)
downloadqutebrowser-538d417e698d70cd66beec26fd5c8447b011cbcc.tar.gz
qutebrowser-538d417e698d70cd66beec26fd5c8447b011cbcc.zip
NSIS: always remove the correct config/cache dirs
The uninstaller now removes the files of the user that started it, even when it's using another account for elevation. The user has to run the uninstaller directly though, because through Windows, it's starting elevated from the get-go.
Diffstat (limited to 'misc/nsis')
-rwxr-xr-xmisc/nsis/uninstall.nsh37
1 files changed, 25 insertions, 12 deletions
diff --git a/misc/nsis/uninstall.nsh b/misc/nsis/uninstall.nsh
index 13cbc2903..9c26532e3 100755
--- a/misc/nsis/uninstall.nsh
+++ b/misc/nsis/uninstall.nsh
@@ -26,6 +26,18 @@ Var RunningFromInstaller ; installer started uninstaller using /uninstall parame
!insertmacro DeleteRetryAbortFunc "un."
!insertmacro CheckSingleInstanceFunc "un."
+Function un.GetConfigDir
+ SetShellVarContext current
+ StrCpy $0 ${CONFIG_DIR}
+ SetShellVarContext all
+FunctionEnd
+
+Function un.GetCacheDir
+ SetShellVarContext current
+ StrCpy $0 ${CACHE_DIR}
+ SetShellVarContext all
+FunctionEnd
+
Section "un.Program Files" SectionUninstallProgram
SectionIn RO
@@ -75,24 +87,25 @@ SectionEnd
Section /o "!un.Program Settings" SectionRemoveSettings
; this section is executed only explicitly and shouldn't be placed in SectionUninstallProgram
- SetShellVarContext current
- RMDIR /r "${CONFIG_DIR}\data"
- RMDIR /r "${CONFIG_DIR}\config"
- RMDIR "${CONFIG_DIR}"
- ${if} $MultiUser.InstallMode == "AllUsers"
- SetShellVarContext all
+ ${if} $MultiUser.InstallMode == "CurrentUser"
+ !insertmacro UAC_AsUser_GetGlobal $0 ${CONFIG_DIR}
+ ${else}
+ !insertmacro UAC_AsUser_Call Function un.GetConfigDir ${UAC_SYNCREGISTERS}
${endif}
+ RMDIR /r "$0\data"
+ RMDIR /r "$0\config"
+ RMDIR "$0"
SectionEnd
Section /o "un.Program Cache" SectionRemoveCache
; this section is executed only explicitly and shouldn't be placed in SectionUninstallProgram
- SetShellVarContext current
- RMDIR /r "${CACHE_DIR}\cache"
- RMDIR "${CACHE_DIR}"
- ${if} $MultiUser.InstallMode == "AllUsers"
- SetShellVarContext all
+ ${if} $MultiUser.InstallMode == "CurrentUser"
+ !insertmacro UAC_AsUser_GetGlobal $0 ${CACHE_DIR}
+ ${else}
+ !insertmacro UAC_AsUser_Call Function un.GetCacheDir ${UAC_SYNCREGISTERS}
${endif}
-
+ RMDIR /r "$0\cache"
+ RMDIR "$0"
SectionEnd
Section "-Uninstall" ; hidden section, must always be the last one!