Fix Add-Path helper function and start using it in scripts
authorJoni Jäntti <joni.jantti@qt.io>
Mon, 4 Sep 2017 10:25:44 +0000 (13:25 +0300)
committerJoni Jäntti <joni.jantti@qt.io>
Mon, 4 Sep 2017 12:11:17 +0000 (12:11 +0000)
This function was broken and only added the latest addition to the
actual PATH.

Change-Id: Ida352c7b605c1b9748bb98e4f51ce68a765c3ce3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
coin/provisioning/common/cmake.ps1
coin/provisioning/common/helpers.ps1
coin/provisioning/common/install-ruby.ps1
coin/provisioning/common/python.ps1

index 50e2e82..8a94dc5 100644 (file)
@@ -53,5 +53,7 @@ if((Test-Path -Path "C:\CMake" )){
 $defaultinstallfolder = "C:\cmake-" + $version + "-win32-x86"
 Rename-Item $defaultinstallfolder C:\CMake
 
+Add-Path "C:\CMake\bin"
+
 echo "CMake = $version" >> ~\versions.txt
 
index 3f7f0a6..846f58a 100644 (file)
@@ -86,7 +86,9 @@ function Add-Path
         [string]$Path
     )
     echo "Adding $Path to Path"
-    [Environment]::SetEnvironmentVariable("Path", $env:Path + ";$Path", [EnvironmentVariableTarget]::Machine)
+
+    $oldPath = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
+    [Environment]::SetEnvironmentVariable("Path", $oldPath + ";$Path", [EnvironmentVariableTarget]::Machine)
 }
 
 function is64bitWinHost
index 81b0134..57cf227 100644 (file)
@@ -55,7 +55,6 @@ cmd /c "$rubyPackage /silent"
 echo "Cleaning $rubyPackage.."
 Remove-Item -Recurse -Force "$rubyPackage"
 
-$oldPath = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
-[Environment]::SetEnvironmentVariable("Path", $oldPath + ";C:\Ruby22-x64\bin", [EnvironmentVariableTarget]::Machine)
+Add-Path "C:\Ruby22-x64\bin"
 
 echo "Ruby = $version" >> ~\versions.txt
index 0be96ee..c3eba2d 100644 (file)
@@ -59,8 +59,7 @@ echo "Chancing allowZip64 value to 'True'..."
 echo "Remove $package..."
 del $package
 
-$oldPath = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
-[Environment]::SetEnvironmentVariable("Path", $oldPath + ";C:\Python27;C:\Python27\Scripts", [EnvironmentVariableTarget]::Machine)
+Add-Path "C:\Python27;C:\Python27\Scripts"
 
 C:\Python27\python.exe -m ensurepip
 # Install python virtual env