From dde0c9c001ddb75d463be78562e00463a8058cb5 Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Wed, 21 Aug 2019 10:04:26 +0800 Subject: fix nev --- scripts/installer.nsi | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/installer.nsi b/scripts/installer.nsi index 1b139447e..2a843d9cf 100644 --- a/scripts/installer.nsi +++ b/scripts/installer.nsi @@ -285,9 +285,19 @@ Section "Add to PATH" InstallPath !macroend ${If} $NOADMIN == "false" - !insertmacro AddRegPATH ${HKLM} + ; Remove the installation path from the $PATH environment variable first + ReadRegStr $R0 ${HKLM} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" + ${WordReplace} $R0 ";$InstDir" "" "+" $R1 + + ; Write the installation path into the $PATH environment variable + WriteRegExpandStr ${HKLM} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$R1;$InstDir" ${Else} - !insertmacro AddRegPATH ${HKCU} + ; Remove the installation path from the $PATH environment variable first + ReadRegStr $R0 ${HKCU} "Environment" "Path" + ${WordReplace} $R0 ";$InstDir" "" "+" $R1 + + ; Write the installation path into the $PATH environment variable + WriteRegExpandStr ${HKCU} "Environment" "Path" "$R1;$InstDir" ${EndIf} SectionEnd -- cgit v1.3.1 From c6786f85771ce5eed276c8dbf6831d5944c6b1c9 Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Wed, 21 Aug 2019 10:09:11 +0800 Subject: fix #540 --- scripts/installer.nsi | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'scripts') diff --git a/scripts/installer.nsi b/scripts/installer.nsi index 2a843d9cf..b3723a3ca 100644 --- a/scripts/installer.nsi +++ b/scripts/installer.nsi @@ -275,15 +275,6 @@ SectionEnd Section "Add to PATH" InstallPath - !macro AddRegPATH RootKey - ; Remove the installation path from the $PATH environment variable first - ReadRegStr $R0 ${RootKey} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" - ${WordReplace} $R0 ";$InstDir" "" "+" $R1 - - ; Write the installation path into the $PATH environment variable - WriteRegExpandStr ${RootKey} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$R1;$InstDir" - !macroend - ${If} $NOADMIN == "false" ; Remove the installation path from the $PATH environment variable first ReadRegStr $R0 ${HKLM} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" @@ -333,23 +324,22 @@ FunctionEnd Section "Uninstall" - !macro RemoveReg RootKey - ; Remove registry keys - DeleteRegKey ${RootKey} ${RegUninstall} - - ; Remove the installation path from the $PATH environment variable - ReadRegStr $R0 ${RootKey} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" - ${WordReplace} $R0 ";$InstDir" "" "+" $R1 - ; MessageBox MB_OK|MB_USERICON '$R0 - $InstDir - $R1 ' - WriteRegExpandStr ${RootKey} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$R1" - !macroend - ; Remove directories used RMDir /r "$InstDir" + + ; Clean reg ${If} $NOADMIN == "false" - !insertmacro RemoveReg ${HKLM} + DeleteRegKey ${HKLM} ${RegUninstall} + ; Remove the installation path from the $PATH environment variable + ReadRegStr $R0 ${HKLM} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" + ${WordReplace} $R0 ";$InstDir" "" "+" $R1 + WriteRegExpandStr ${HKLM} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$R1" ${Else} - !insertmacro RemoveReg ${HKCU} + DeleteRegKey ${HKCU} ${RegUninstall} + ; Remove the installation path from the $PATH environment variable + ReadRegStr $R0 ${HKCU} "Environment" "Path" + ${WordReplace} $R0 ";$InstDir" "" "+" $R1 + WriteRegExpandStr ${HKCU} "Environment" "Path" "$R1" ${EndIf} SectionEnd -- cgit v1.3.1