diff options
| author | Wimok Nupphiboon <wimok.mok@gmail.com> | 2018-03-30 21:58:49 +0700 |
|---|---|---|
| committer | Wimok Nupphiboon <wimok.mok@gmail.com> | 2018-03-30 21:58:49 +0700 |
| commit | c681f4ee840c81a508fc0e8352c9aedf66fb5eaf (patch) | |
| tree | 5bda96eca1cee03af97da726b9b3d3038d75fae1 /scripts/fetchTool.ps1 | |
| parent | 663be4bbffd435cf5e5fc62a0774c784c10ddc68 (diff) | |
| parent | f9d4692749ad68340a07453add49a8ef029fa155 (diff) | |
| download | vcpkg-c681f4ee840c81a508fc0e8352c9aedf66fb5eaf.tar.gz vcpkg-c681f4ee840c81a508fc0e8352c9aedf66fb5eaf.zip | |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'scripts/fetchTool.ps1')
| -rw-r--r-- | scripts/fetchTool.ps1 | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/scripts/fetchTool.ps1 b/scripts/fetchTool.ps1 index ff9b5d9bf..26eedac3b 100644 --- a/scripts/fetchTool.ps1 +++ b/scripts/fetchTool.ps1 @@ -25,7 +25,7 @@ function fetchToolInternal([Parameter(Mandatory=$true)][string]$tool) throw "Unkown tool $tool" } - $exePath = "$downloadsDir\$(@($toolData.exeRelativePath)[0])" + $exePath = "$downloadsDir\$($toolData.exeRelativePath)" if (Test-Path $exePath) { @@ -35,22 +35,22 @@ function fetchToolInternal([Parameter(Mandatory=$true)][string]$tool) $isArchive = vcpkgHasProperty -object $toolData -propertyName "archiveRelativePath" if ($isArchive) { - $downloadPath = "$downloadsDir\$(@($toolData.archiveRelativePath)[0])" + $downloadPath = "$downloadsDir\$($toolData.archiveRelativePath)" } else { - $downloadPath = "$downloadsDir\$(@($toolData.exeRelativePath)[0])" + $downloadPath = "$downloadsDir\$($toolData.exeRelativePath)" } - [String]$url = @($toolData.url)[0] + [String]$url = $toolData.url if (!(Test-Path $downloadPath)) { Write-Host "Downloading $tool..." vcpkgDownloadFile $url $downloadPath - Write-Host "Downloading $tool has completed successfully." + Write-Host "Downloading $tool... done." } - $expectedDownloadedFileHash = @($toolData.sha256)[0] + $expectedDownloadedFileHash = $toolData.sha256 $downloadedFileHash = vcpkgGetSHA256 $downloadPath vcpkgCheckEqualFileHash -filePath $downloadPath -expectedHash $expectedDownloadedFileHash -actualHash $downloadedFileHash @@ -58,13 +58,14 @@ function fetchToolInternal([Parameter(Mandatory=$true)][string]$tool) { $outFilename = (Get-ChildItem $downloadPath).BaseName Write-Host "Extracting $tool..." - vcpkgExtractFile -File $downloadPath -DestinationDir $downloadsDir -outFilename $outFilename - Write-Host "Extracting $tool has completed successfully." + vcpkgExtractFile -ArchivePath $downloadPath -DestinationDir $downloadsDir -outFilename $outFilename + Write-Host "Extracting $tool... done." } if (-not (Test-Path $exePath)) { - throw ("Could not detect or download " + $tool) + Write-Error "Could not detect or download $tool" + throw } return $exePath |
