From 7b555b17b132c8f0f427bdb10352d4c87765064d Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 15 Sep 2016 02:27:39 +0200 Subject: [PATCH] Fix rare Windows install bug: clears PATH env var if longer than 1024 chars --- doc/ReleaseNotes | 1 + makepanda/installer.nsi | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 49ed03cd78..1da0320973 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -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 ------------------------ diff --git a/makepanda/installer.nsi b/makepanda/installer.nsi index c5e0df0e5f..8203954cf6 100755 --- a/makepanda/installer.nsi +++ b/makepanda/installer.nsi @@ -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