summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTitanSnow <[email protected]>2017-05-26 21:25:47 +0800
committerTitanSnow <[email protected]>2017-05-26 21:25:47 +0800
commitd38e09982e512c9427a5715cd742003f9664a999 (patch)
treed333979d0c065d84489f9ced843657d360dffae2
parentf7d8a8ceafb1fd56dccdc3910ad7d62dba041177 (diff)
not add to path if added
-rw-r--r--scripts/getpb.ps18
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/getpb.ps1 b/scripts/getpb.ps1
index 1e6ad98d7..b9b3f08ee 100644
--- a/scripts/getpb.ps1
+++ b/scripts/getpb.ps1
@@ -77,8 +77,12 @@ try{
Expand-Archive "$installdir\temp.zip" "$installdir\temp" -Force
Move-Item "$installdir\temp\xmake-$branch\xmake\*" $installdir
Remove-Item "$installdir\temp","$installdir\temp.zip" -Recurse -Force
- $env:Path+=";$installdir"
- [Environment]::SetEnvironmentVariable("Path",[Environment]::GetEnvironmentVariable("Path",[System.EnvironmentVariableTarget]::User)+";$installdir",[System.EnvironmentVariableTarget]::User) # this step is optional because installer writes path to regedit
+ try{
+ xmake --version | Out-Null
+ }catch{
+ $env:Path+=";$installdir"
+ [Environment]::SetEnvironmentVariable("Path",[Environment]::GetEnvironmentVariable("Path",[System.EnvironmentVariableTarget]::User)+";$installdir",[System.EnvironmentVariableTarget]::User)
+ }
xmake --version
}catch{
writeErrorTip 'Error!'