Clone in a terminal:
Commit ab04cb1
Johan Mattsson - 2026-11-02T16:08:04+00:00
ab04cb1a2f0fc9e11b20b5025039a6fe96ff4d77johan.mattsson.m@gmail.com

Add exe to path in windows installer

Changed files (1)

Diff

diff --git a/src-tauri/windows/hooks.nsh b/src-tauri/windows/hooks.nshnew file mode 100644index 0000000..da8db9e--- /dev/null+++ b/src-tauri/windows/hooks.nsh@@ -0,0 +1,41 @@+; Make the current-user NSIS installation available to new shell sessions.+; Tauri calls these hooks after `$INSTDIR` has been established.+!include "WinMessages.nsh"+!include "StrFunc.nsh"+${StrRep}++!macro NotifyEnvironmentChanged+  SendMessage ${HWND_BROADCAST} ${WM_SETTINGCHANGE} 0 "STR:Environment" /TIMEOUT=5000+!macroend++!macro NSIS_HOOK_POSTINSTALL+  ReadRegStr $0 HKCU "Environment" "Path"+  ${If} $0 == ""+    WriteRegExpandStr HKCU "Environment" "Path" "$INSTDIR"+    !insertmacro NotifyEnvironmentChanged+  ${Else}+    ; Delimit the value to match a complete PATH entry, not a prefix.+    StrCpy $1 ";$0;"+    ${StrLoc} $2 "$1" ";$INSTDIR;" ">"+    ${If} $2 == ""+      WriteRegExpandStr HKCU "Environment" "Path" "$0;$INSTDIR"+      !insertmacro NotifyEnvironmentChanged+    ${EndIf}+  ${EndIf}+!macroend++!macro NSIS_HOOK_PREUNINSTALL+  ReadRegStr $0 HKCU "Environment" "Path"+  ${If} $0 == "$INSTDIR"+    DeleteRegValue HKCU "Environment" "Path"+    !insertmacro NotifyEnvironmentChanged+  ${ElseIf} $0 != ""+    ; The installer appends its own entry. Remove it without affecting other entries.+    ${StrRep} $1 "$0" ";$INSTDIR" ""+    ${StrRep} $1 "$1" "$INSTDIR;" ""+    ${If} $1 != "$0"+      WriteRegExpandStr HKCU "Environment" "Path" "$1"+      !insertmacro NotifyEnvironmentChanged+    ${EndIf}+  ${EndIf}+!macroend

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112