summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorruki <[email protected]>2019-08-21 14:25:05 +0800
committerGitHub <[email protected]>2019-08-21 14:25:05 +0800
commitbb8580531e75a4ebd190126c442b61fe319044e3 (patch)
treed34c7d0935b6b9b95b0aad18eec09d04b6d54fec /scripts
parent2c891f5a18aec7d47d3458ef39b9294d7f3b4d59 (diff)
parentf6b1a4866e1c73aafe6decdc6bfc1d99653f2b64 (diff)
Merge pull request #543 from OpportunityLiu/dev
improve runenvs
Diffstat (limited to 'scripts')
-rw-r--r--scripts/installer.nsi42
1 files changed, 21 insertions, 21 deletions
diff --git a/scripts/installer.nsi b/scripts/installer.nsi
index 1b139447e..b3723a3ca 100644
--- a/scripts/installer.nsi
+++ b/scripts/installer.nsi
@@ -275,19 +275,20 @@ SectionEnd
Section "Add to PATH" InstallPath
- !macro AddRegPATH RootKey
+ ${If} $NOADMIN == "false"
; Remove the installation path from the $PATH environment variable first
- ReadRegStr $R0 ${RootKey} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
+ ReadRegStr $R0 ${HKLM} "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"
- !insertmacro AddRegPATH ${HKLM}
+ 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
@@ -323,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