Skip to content

Commit 2dacb6e

Browse files
committed
Fix bug where it deletes the entire user PATH
1 parent 0f26b9c commit 2dacb6e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

installer/installer.nsi

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@ Section "Install"
1212
SetOutPath "$INSTDIR"
1313
File "..\build\Debug\opencmd.exe"
1414

15-
ReadRegStr $0 HKCU "Environment" "Path"
16-
StrCpy $1 $INSTDIR
15+
ReadRegStr $0 HKCU "Environment" "Path"
16+
StrCpy $1 "$INSTDIR"
1717

1818
${If} $0 != ""
1919
${StrStr} $2 $0 $1
2020
${If} $2 == ""
21-
StrCpy $0 "$0;$INSTDIR"
22-
WriteRegStr HKCU "Environment" "Path" "$0"
23-
; Broadcast the environment change
24-
System::Call 'User32::SendMessageTimeout(i 0xffff, i ${WM_SETTINGCHANGE}, i 0, t "Environment", i 0x0002, i 5000, *i .r0)'
21+
StrCpy $0 "$0;$1"
2522
${EndIf}
2623
${Else}
27-
WriteRegStr HKCU "Environment" "Path" "$INSTDIR"
28-
System::Call 'User32::SendMessageTimeout(i 0xffff, i ${WM_SETTINGCHANGE}, i 0, t "Environment", i 0x0002, i 5000, *i .r0)'
24+
StrCpy $0 "$1"
2925
${EndIf}
26+
27+
System::Call 'User32::SendMessageTimeout(i 0xffff, i ${WM_SETTINGCHANGE}, i 0, t "Environment", i 0x0002, i 5000, *i .r0)'
3028
MessageBox MB_OK "Installation complete. Please restart any running programs for PATH changes to apply."
3129
SectionEnd

0 commit comments

Comments
 (0)