diff options
| author | 2024-05-27 21:48:43 +0100 | |
|---|---|---|
| committer | 2024-05-27 21:48:43 +0100 | |
| commit | 112f4fbb1c1e8bacb94329c075b7502b2ae6b853 (patch) | |
| tree | bb998e50a00a8c0723e3a80dc1f722f6c20adf77 | |
| parent | Fix the indentation of the contributors list. (diff) | |
Sync the Windows NSIS installer with the latest code from CMake.
| -rw-r--r-- | win/NSIS.template.in | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/win/NSIS.template.in b/win/NSIS.template.in index f193f2f79..303a3ef18 100644 --- a/win/NSIS.template.in +++ b/win/NSIS.template.in @@ -1,4 +1,4 @@ -; CPack install script designed for a nmake build
+; CPack install script designed for a nmake build
;--------------------------------
; You must define these values
@@ -470,21 +470,21 @@ FunctionEnd !insertmacro StrStr "un."
Function Trim ; Added by Pelaca
- Exch $R1
- Push $R2
+ Exch $R1
+ Push $R2
Loop:
- StrCpy $R2 "$R1" 1 -1
- StrCmp "$R2" " " RTrim
- StrCmp "$R2" "$\n" RTrim
- StrCmp "$R2" "$\r" RTrim
- StrCmp "$R2" ";" RTrim
- GoTo Done
+ StrCpy $R2 "$R1" 1 -1
+ StrCmp "$R2" " " RTrim
+ StrCmp "$R2" "$\n" RTrim
+ StrCmp "$R2" "$\r" RTrim
+ StrCmp "$R2" ";" RTrim
+ GoTo Done
RTrim:
- StrCpy $R1 "$R1" -1
- Goto Loop
+ StrCpy $R1 "$R1" -1
+ Goto Loop
Done:
- Pop $R2
- Exch $R1
+ Pop $R2
+ Exch $R1
FunctionEnd
Function ConditionalAddToRegistry
@@ -937,11 +937,20 @@ Function .onInit ;Run the uninstaller
uninst:
ClearErrors
- StrCpy $2 $0 1
- StrCmp '"' $2 0 +3 ; checks if string is quoted (CPack before v3.20.6 did not quote it)
- ExecWait '$0 /S'
- Goto +2
- ExecWait '"$0" /S'
+ # $0 should _always_ be quoted, however older versions of CMake did not
+ # do this. We'll conditionally remove the begin/end quotes.
+ # Remove first char if quote
+ StrCpy $2 $0 1 0 # copy first char
+ StrCmp $2 "$\"" 0 +2 # if char is quote
+ StrCpy $0 $0 "" 1 # remove first char
+ # Remove last char if quote
+ StrCpy $2 $0 1 -1 # copy last char
+ StrCmp $2 "$\"" 0 +2 # if char is quote
+ StrCpy $0 $0 -1 # remove last char
+
+ StrLen $2 "\@CPACK_NSIS_UNINSTALL_NAME@.exe"
+ StrCpy $3 $0 -$2 # remove "\@CPACK_NSIS_UNINSTALL_NAME@.exe" from UninstallString to get path
+ ExecWait '"$0" /S _?=$3' ;Do not copy the uninstaller to a temp file
IfErrors uninst_failed inst
uninst_failed:
@@ -978,7 +987,7 @@ inst: ;MessageBox MB_OK 'User "$0" is in the Admin group'
StrCpy $SV_ALLUSERS "AllUsers"
Goto done
- StrCmp $1 "Power" 0 +4
+ StrCmp $1 "Power" 0 +3
SetShellVarContext all
;MessageBox MB_OK 'User "$0" is in the Power Users group'
StrCpy $SV_ALLUSERS "AllUsers"
|
