fix windows install
This commit is contained in:
@@ -8,6 +8,14 @@
|
|||||||
!endif
|
!endif
|
||||||
|
|
||||||
!macro customCheckAppRunning
|
!macro customCheckAppRunning
|
||||||
|
; Pre-emptively remove old shortcuts to prevent the Windows "Missing Shortcut"
|
||||||
|
; dialog during upgrades. The built-in NSIS uninstaller deletes ClawX.exe
|
||||||
|
; *before* removing shortcuts; Windows Shell link tracking can detect the
|
||||||
|
; broken target in that brief window and pop a resolver dialog.
|
||||||
|
; Delete is a silent no-op when the file doesn't exist (safe for fresh installs).
|
||||||
|
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
|
||||||
|
Delete "$SMPROGRAMS\${PRODUCT_NAME}.lnk"
|
||||||
|
|
||||||
${nsProcess::FindProcess} "${APP_EXECUTABLE_FILENAME}" $R0
|
${nsProcess::FindProcess} "${APP_EXECUTABLE_FILENAME}" $R0
|
||||||
|
|
||||||
${if} $R0 == 0
|
${if} $R0 == 0
|
||||||
@@ -73,7 +81,15 @@
|
|||||||
|
|
||||||
; Add resources\cli to the current user's PATH for openclaw CLI.
|
; Add resources\cli to the current user's PATH for openclaw CLI.
|
||||||
; Read current PATH, skip if already present, append otherwise.
|
; Read current PATH, skip if already present, append otherwise.
|
||||||
|
;
|
||||||
|
; ReadRegStr silently returns "" when the value exceeds the NSIS string
|
||||||
|
; buffer (8192 chars for the electron-builder large-strings build).
|
||||||
|
; Without an error-flag check we would overwrite the entire user PATH with
|
||||||
|
; only our CLI directory, destroying every other PATH entry.
|
||||||
|
ClearErrors
|
||||||
ReadRegStr $0 HKCU "Environment" "Path"
|
ReadRegStr $0 HKCU "Environment" "Path"
|
||||||
|
IfErrors _ci_readFailed
|
||||||
|
|
||||||
StrCmp $0 "" _ci_setNew
|
StrCmp $0 "" _ci_setNew
|
||||||
|
|
||||||
; Check if our CLI dir is already in PATH
|
; Check if our CLI dir is already in PATH
|
||||||
@@ -94,6 +110,12 @@
|
|||||||
WriteRegExpandStr HKCU "Environment" "Path" $0
|
WriteRegExpandStr HKCU "Environment" "Path" $0
|
||||||
; Broadcast WM_SETTINGCHANGE so running Explorer/terminals pick up the change
|
; Broadcast WM_SETTINGCHANGE so running Explorer/terminals pick up the change
|
||||||
SendMessage ${HWND_BROADCAST} ${WM_SETTINGCHANGE} 0 "STR:Environment" /TIMEOUT=500
|
SendMessage ${HWND_BROADCAST} ${WM_SETTINGCHANGE} 0 "STR:Environment" /TIMEOUT=500
|
||||||
|
Goto _ci_done
|
||||||
|
|
||||||
|
_ci_readFailed:
|
||||||
|
; PATH value could not be read (likely exceeds NSIS buffer).
|
||||||
|
; Skip modification to avoid destroying existing entries.
|
||||||
|
DetailPrint "Warning: Could not read user PATH (may exceed 8192 chars). Skipping PATH update."
|
||||||
|
|
||||||
_ci_done:
|
_ci_done:
|
||||||
!macroend
|
!macroend
|
||||||
@@ -137,7 +159,9 @@ FunctionEnd
|
|||||||
|
|
||||||
!macro customUnInstall
|
!macro customUnInstall
|
||||||
; Remove resources\cli from user PATH
|
; Remove resources\cli from user PATH
|
||||||
|
ClearErrors
|
||||||
ReadRegStr $0 HKCU "Environment" "Path"
|
ReadRegStr $0 HKCU "Environment" "Path"
|
||||||
|
IfErrors _cu_pathDone
|
||||||
StrCmp $0 "" _cu_pathDone
|
StrCmp $0 "" _cu_pathDone
|
||||||
|
|
||||||
; Remove our entry (with leading or trailing semicolons)
|
; Remove our entry (with leading or trailing semicolons)
|
||||||
@@ -145,8 +169,17 @@ FunctionEnd
|
|||||||
Push "$INSTDIR\resources\cli"
|
Push "$INSTDIR\resources\cli"
|
||||||
Call un._cu_RemoveFromPath
|
Call un._cu_RemoveFromPath
|
||||||
Pop $0
|
Pop $0
|
||||||
|
|
||||||
|
; If PATH is now empty, delete the registry value instead of writing ""
|
||||||
|
StrCmp $0 "" _cu_deletePath
|
||||||
WriteRegExpandStr HKCU "Environment" "Path" $0
|
WriteRegExpandStr HKCU "Environment" "Path" $0
|
||||||
SendMessage ${HWND_BROADCAST} ${WM_SETTINGCHANGE} 0 "STR:Environment" /TIMEOUT=500
|
Goto _cu_pathBroadcast
|
||||||
|
|
||||||
|
_cu_deletePath:
|
||||||
|
DeleteRegValue HKCU "Environment" "Path"
|
||||||
|
|
||||||
|
_cu_pathBroadcast:
|
||||||
|
SendMessage ${HWND_BROADCAST} ${WM_SETTINGCHANGE} 0 "STR:Environment" /TIMEOUT=500
|
||||||
|
|
||||||
_cu_pathDone:
|
_cu_pathDone:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user