Skip to content

Commit 27006bd

Browse files
committed
Added more path manipulation
1 parent 8240879 commit 27006bd

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

scripts/appveyor_ci_build.ps1

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,27 @@ function Invoke-BuildCommand($command, $directory = '.')
2525
Pop-Location
2626
}
2727

28+
function Remove-PathFolder($folder)
29+
{
30+
[string[]]$pathFolders = $env:Path -split ";"
31+
for ([int]$i = 0; $i -lt $pathFolders.Count; $i++)
32+
{
33+
if ([string]::Compare($pathFolders[$i], $folder, $true) -eq 0)
34+
{
35+
Write-Host "Removing $folder from the PATH"
36+
$pathFolders.RemoveAt($i)
37+
$i--
38+
}
39+
}
40+
41+
$env:Path = $pathFolders -join ";"
42+
}
43+
44+
function Add-PathFolder($folder)
45+
{
46+
$env:Path = "$folder;$env:Path"
47+
}
48+
2849
# The project files that will get built
2950
$VS2008ProjectFiles = @( 'CppUTest.vcproj' , 'tests\AllTests.vcproj' )
3051
$VS2010ProjectFiles = @( 'CppUTest.vcxproj', 'tests\AllTests.vcxproj' )
@@ -61,7 +82,18 @@ if ($env:PlatformToolset -eq 'v100')
6182

6283
if ($env:PlatformToolset -eq 'MinGW')
6384
{
64-
$env:Path = "C:\Program Files (x86)\CMake 2.8\bin;C:\MinGW\bin;$env:Path"
85+
Write-Host "Initial Path: $env:Path"
86+
87+
# Need to do some path cleanup first
88+
Remove-PathFolder "C:\Program Files\Git\bin"
89+
Remove-PathFolder "C:\Program Files (x86)\Git\bin"
90+
91+
# Add cmake and mingw to the path
92+
Add-PathFolder "C:\Program Files (x86)\CMake 2.8\bin"
93+
Add-PathFolder "C:\MinGW\bin"
94+
95+
Write-Host "Building with Path: $env:Path"
96+
6597
Invoke-BuildCommand "cmake -G 'MSYS Makefiles' .." 'cpputest_build'
6698
Invoke-BuildCommand "mingw32-make all" 'cpputest_build'
6799
}

0 commit comments

Comments
 (0)