Fix rare Windows install bug: clears PATH env var if longer than 1024 chars

This commit is contained in:
rdb 2016-09-15 02:27:39 +02:00
parent 2c651dc96b
commit 7b555b17b1
2 changed files with 12 additions and 7 deletions

View File

@ -36,6 +36,7 @@ This issue fixes several bugs that were still found in 1.9.2.
* asyncFlattenStrong with inPlace=True caused node to disappear
* Fix asyncFlattenStrong called on nodes without parent
* Fix is_playing() check when playing an animation backwards
* Windows installer no longer clears %PATH% if longer than 1024 chars
------------------------ RELEASE 1.9.2 ------------------------

View File

@ -610,11 +610,7 @@ Section -post
Call RemoveFromPath
Push "$INSTDIR\bin"
Call RemoveFromPath
Push "$INSTDIR\python"
Call AddToPath
Push "$INSTDIR\python\Scripts"
Call AddToPath
Push "$INSTDIR\bin"
Push "$INSTDIR\python;$INSTDIR\python\Scripts;$INSTDIR\bin"
Call AddToPath
# This is needed for the environment variable changes to take effect.
@ -897,8 +893,10 @@ Function AddToPath
StrCmp $3 1 0 +2
ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
; If the PATH string is empty, jump over the mangling routines.
StrCmp $1 "" AddToPath_NTdoIt
; If the PATH string is empty, WATCH OUT. This probably means
; the PATH surpassed NSIS' string limit. Don't overwrite it!
; The only thing we can do is display an error message.
StrCmp $1 "" AddToPath_EmptyError
; Pull off the last character of the PATH string. If it's a semicolon,
; we don't need to add another one, so jump to the section where we
@ -906,6 +904,12 @@ Function AddToPath
StrCpy $2 $1 1 -1
StrCmp $2 ";" AddToPath_NTAddPath AddToPath_NTAddSemi
AddToPath_EmptyError:
MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "Your PATH environment variable is too long! Please remove extraneous entries before proceeding. Panda3D needs to add the following the PATH so that the Panda3D utilities and libraries can be located correctly.$\n$\n$0$\n$\nIf you wish to add Panda3D to the path yourself, choose Ignore." IDIGNORE AddToPath_done IDRETRY AddToPath_NT
SetDetailsPrint both
DetailPrint "Cannot append to PATH - variable is likely too long."
SetDetailsPrint listonly
Abort
AddToPath_NTAddSemi:
StrCpy $1 "$1;"
Goto AddToPath_NTAddPath