From 72194ae8a0e435aee63b8e40f585646247672e3b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 27 Mar 2018 04:08:57 -0700 Subject: [PATCH] [ps1] More fixes/tweaks --- scripts/VcpkgPowershellUtils.ps1 | 7 +++++-- scripts/fetchTool.ps1 | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index bc84afa7f..92e0f21d0 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -194,11 +194,14 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$archivePath, } } - $itemCount = @(Get-ChildItem "$destinationPartial").Count + $items = @(Get-ChildItem "$destinationPartial") + $itemCount = $items.Count if ($itemCount -eq 1) { - Move-Item -Path "$destinationPartial\*" -Destination $output + $item = $items | Select-Object -first 1 + Write-Host "$item" + Move-Item -Path "$destinationPartial\$item" -Destination $output vcpkgRemoveItem $destinationPartial } else diff --git a/scripts/fetchTool.ps1 b/scripts/fetchTool.ps1 index a52986553..af6d4d1d9 100644 --- a/scripts/fetchTool.ps1 +++ b/scripts/fetchTool.ps1 @@ -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