Skip to content

Commit

Permalink
fix(nsis): set correct ShellVarContext for uninstaller, closes #7315 (
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir authored Jul 10, 2023
1 parent 32218a6 commit 6e36ebb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .changes/nsis-start-menu-shortcut.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-bundler': 'patch:bug'
---

On Windows, fix NSIS uninstaller failing to remove Start Menu shortcut if `perMachine` mode is used.
34 changes: 15 additions & 19 deletions tooling/bundler/src/bundle/windows/templates/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,7 @@ FunctionEnd
!include "{{this}}"
{{/each}}

Var PassiveMode
Function .onInit
${GetOptions} $CMDLINE "/P" $PassiveMode
IfErrors +2 0
StrCpy $PassiveMode 1

!if "${DISPLAYLANGUAGESELECTOR}" == "true"
!insertmacro MUI_LANGDLL_DISPLAY
!endif

!macro SetContext
!if "${INSTALLMODE}" == "currentUser"
SetShellVarContext current
!else if "${INSTALLMODE}" == "perMachine"
Expand All @@ -369,6 +360,19 @@ Function .onInit
SetRegView 32
!endif
${EndIf}
!macroend

Var PassiveMode
Function .onInit
${GetOptions} $CMDLINE "/P" $PassiveMode
IfErrors +2 0
StrCpy $PassiveMode 1

!if "${DISPLAYLANGUAGESELECTOR}" == "true"
!insertmacro MUI_LANGDLL_DISPLAY
!endif

!insertmacro SetContext

${If} $INSTDIR == ""
; Set default install location
Expand Down Expand Up @@ -595,15 +599,7 @@ Function .onInstSuccess
FunctionEnd

Function un.onInit
${If} ${RunningX64}
!if "${ARCH}" == "x64"
SetRegView 64
!else if "${ARCH}" == "arm64"
SetRegView 64
!else
SetRegView 32
!endif
${EndIf}
!insertmacro SetContext

!if "${INSTALLMODE}" == "both"
!insertmacro MULTIUSER_UNINIT
Expand Down

0 comments on commit 6e36ebb

Please sign in to comment.