#267 fix windows installer emptying user Path variable

This commit is contained in:
lepapareil 2021-10-07 13:49:55 +02:00 committed by Fabrice Reix
parent 98632ed4c3
commit 215b0f4855
3 changed files with 11 additions and 5 deletions

View File

@ -113,9 +113,10 @@ jobs:
Get-ChildItem .\*win64.zip
cd ..\..
# create installer
(Get-Command choco).Path
choco install --confirm --no-progress nsis
refreshenv
refreshenv
Get-Command Expand-Archive
Expand-Archive -Path '.\ci\windows\EnVar_plugin.zip' -DestinationPath 'C:\Program Files (x86)\NSIS' -Verbose
cd .\target\win-package
makensis.exe /NOCD /V4 ..\..\ci\windows\hurl.nsi
- name: Archive production artifacts

BIN
ci/windows/EnVar_plugin.zip Normal file

Binary file not shown.

View File

@ -52,8 +52,13 @@ SectionGroup "executables"
SetOutPath $INSTDIR
File "hurl.exe"
; Write installation path
ReadRegStr $0 HKCU "Environment" "Path"
WriteRegStr HKCU "Environment" "path" "$0;$INSTDIR"
EnVar::SetHKCU
EnVar::Check "NULL" "NULL"
EnVar::DeleteValue "Path" ";$INSTDIR"
EnVar::DeleteValue "Path" "$INSTDIR;"
EnVar::AddValue "Path" ";$INSTDIR"
; ReadRegStr $0 HKCU "Environment" "Path"
; WriteRegStr HKCU "Environment" "path" "$0;$INSTDIR"
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
; Write the uninstall
WriteUninstaller "$INSTDIR\uninstall.exe"
@ -122,4 +127,4 @@ Section "Uninstall"
Delete $INSTDIR\*
; Remove directories
RMDir "$INSTDIR"
SectionEnd
SectionEnd