1 # Downloads are done from the official github release page links
2 $downloadUrl = "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.7.0/OpenCppCoverageSetup-x64-0.9.7.0.exe"
3 $installerPath = [System.IO.Path]::Combine($Env:USERPROFILE, "Downloads", "OpenCppCoverageSetup.exe")
4 
5 if(-Not (Test-Path $installerPath)) {
6     Write-Host -ForegroundColor White ("Downloading OpenCppCoverage from: " + $downloadUrl)
7     Start-FileDownload $downloadUrl -FileName $installerPath
8 }
9 
10 Write-Host -ForegroundColor White "About to install OpenCppCoverage..."
11 
12 $installProcess = (Start-Process $installerPath -ArgumentList '/VERYSILENT' -PassThru -Wait)
13 if($installProcess.ExitCode -ne 0) {
14     throw [System.String]::Format("Failed to install OpenCppCoverage, ExitCode: {0}.", $installProcess.ExitCode)
15 }
16 
17 # Assume standard, boring, installation path of ".../Program Files/OpenCppCoverage"
18 $installPath = [System.IO.Path]::Combine(${Env:ProgramFiles}, "OpenCppCoverage")
19 $env:Path="$env:Path;$installPath"
20