Skip to content

Commit

Permalink
feat(nsis)!: switch to both installMode
Browse files Browse the repository at this point in the history
fix: nsis template
  • Loading branch information
greenhat616 committed Feb 7, 2024
1 parent cffd388 commit ce3c138
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"installerIcon": "icons/icon.ico",
"languages": ["SimpChinese", "English", "Russian"],
"license": "../../LICENSE",
"installMode": "perMachine",
"installMode": "both",
"template": "./templates/installer.nsi"
}
}
Expand Down
11 changes: 9 additions & 2 deletions backend/tauri/templates/installer.nsi
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
; This file is copied from https://github.com/tauri-apps/tauri/blob/tauri-v1.5/tooling/bundler/src/bundle/windows/templates/installer.nsi
; and edit to fit the needs of the project. the latest tauri 2.x has a different base nsi script.

Unicode true
; Set the compression algorithm. Default is LZMA.
!if "{{compression}}" == ""
Expand All @@ -10,6 +13,7 @@ Unicode true
!include FileFunc.nsh
!include x64.nsh
!include WordFunc.nsh
!include "LogicLib.nsh"
!include "StrFunc.nsh"
${StrCase}
${StrLoc}
Expand Down Expand Up @@ -144,6 +148,7 @@ Function PageReinstall
; however, this should be fine since the user will have to confirm the uninstallation
; and they can chose to abort it if doesn't make sense.
StrCpy $0 0

wix_loop:
EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $0
StrCmp $1 "" wix_done ; Exit loop if there is no more keys to loop on
Expand Down Expand Up @@ -424,6 +429,7 @@ FunctionEnd
nsis_tauri_utils::KillProcess "Clash Nyanpasu.exe"
!endif
${EndIf}


; Check if clash-verge-service.exe is running
nsis_tauri_utils::FindProcess "clash-verge-service.exe"
Expand All @@ -436,6 +442,7 @@ FunctionEnd
!endif
${EndIf}


; Check if mihomo-alpha.exe is running
nsis_tauri_utils::FindProcess "mihomo-alpha.exe"
${If} $R0 != 0
Expand Down Expand Up @@ -606,7 +613,7 @@ Section Install
SetOutPath $INSTDIR

!insertmacro CheckIfAppIsRunning

!insertmacro CheckAllNyanpasuProcesses
; Copy main executable
File "${MAINBINARYSRCPATH}"

Expand Down Expand Up @@ -693,7 +700,7 @@ FunctionEnd

Section Uninstall
!insertmacro CheckIfAppIsRunning

!insertmacro CheckAllNyanpasuProcesses
; Delete the app directory and its content from disk
; Copy main executable
Delete "$INSTDIR\${MAINBINARYNAME}.exe"
Expand Down

0 comments on commit ce3c138

Please sign in to comment.