From 9f0a5fceaced7862c8a57beba6616c21ff3b17f8 Mon Sep 17 00:00:00 2001 From: Tony <68118705+Legend-Master@users.noreply.github.com> Date: Mon, 15 Jul 2024 19:54:02 +0800 Subject: [PATCH] changes(nsis): move pre hooks before kill app (#10271) --- .changes/nsis-pre-hooks-timing.md | 5 +++++ .../bundler/src/bundle/windows/templates/installer.nsi | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changes/nsis-pre-hooks-timing.md diff --git a/.changes/nsis-pre-hooks-timing.md b/.changes/nsis-pre-hooks-timing.md new file mode 100644 index 000000000000..55368b3bed16 --- /dev/null +++ b/.changes/nsis-pre-hooks-timing.md @@ -0,0 +1,5 @@ +--- +"tauri-bundler": "patch:changes" +--- + +Make `NSIS_HOOK_PREINSTALL` and `NSIS_HOOK_PREUNINSTALL` run before `CheckIfAppIsRunning` (which checks if the app is running and asks the user if they want to kill the app) diff --git a/tooling/bundler/src/bundle/windows/templates/installer.nsi b/tooling/bundler/src/bundle/windows/templates/installer.nsi index 860295b5aaff..7e015362751c 100644 --- a/tooling/bundler/src/bundle/windows/templates/installer.nsi +++ b/tooling/bundler/src/bundle/windows/templates/installer.nsi @@ -556,12 +556,12 @@ SectionEnd Section Install SetOutPath $INSTDIR - !insertmacro CheckIfAppIsRunning - !ifmacrodef NSIS_HOOK_PREINSTALL !insertmacro NSIS_HOOK_PREINSTALL !endif + !insertmacro CheckIfAppIsRunning + ; Copy main executable File "${MAINBINARYSRCPATH}" @@ -683,12 +683,12 @@ FunctionEnd Section Uninstall - !insertmacro CheckIfAppIsRunning - !ifmacrodef NSIS_HOOK_PREUNINSTALL !insertmacro NSIS_HOOK_PREUNINSTALL !endif + !insertmacro CheckIfAppIsRunning + ; Delete the app directory and its content from disk ; Copy main executable Delete "$INSTDIR\${MAINBINARYNAME}.exe"