diff options
| author | Wimok Nupphiboon <wimok.mok@gmail.com> | 2018-03-24 11:53:55 +0700 |
|---|---|---|
| committer | Wimok Nupphiboon <wimok.mok@gmail.com> | 2018-03-24 11:53:55 +0700 |
| commit | 663be4bbffd435cf5e5fc62a0774c784c10ddc68 (patch) | |
| tree | d214f24405fa75d4dad9dfb938a04846d2ca6102 /scripts/VcpkgPowershellUtils.ps1 | |
| parent | 1e380dde21317e73d1859dad1c64c06eb88cc502 (diff) | |
| parent | aa57df6d6ed6d17000522492b66fc93d3f32ab86 (diff) | |
| download | vcpkg-663be4bbffd435cf5e5fc62a0774c784c10ddc68.tar.gz vcpkg-663be4bbffd435cf5e5fc62a0774c784c10ddc68.zip | |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'scripts/VcpkgPowershellUtils.ps1')
| -rw-r--r-- | scripts/VcpkgPowershellUtils.ps1 | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index 2dbf04085..d9c9e3760 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -140,6 +140,7 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, { Write-Warning "Github has dropped support for TLS versions prior to 1.2, which is not available on your system" Write-Warning "Please manually download $url to $downloadPath" + Write-Warning "To solve this issue for future downloads, you can also install Windows Management Framework 5.1+" throw "Download failed" } } @@ -172,10 +173,6 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, vcpkgRemoveItem $destinationPartial vcpkgCreateDirectoryIfNotExists $destinationPartial - $shell = new-object -com shell.application - $zip = $shell.NameSpace($(Get-Item $file).fullname) - $itemCount = $zip.Items().Count - if (vcpkgHasCommand -commandName 'Microsoft.PowerShell.Archive\Expand-Archive') { Write-Verbose("Extracting with Microsoft.PowerShell.Archive\Expand-Archive") @@ -189,6 +186,8 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, else { Write-Verbose("Extracting via shell") + $shell = new-object -com shell.application + $zip = $shell.NameSpace($(Get-Item $file).fullname) foreach($item in $zip.items()) { # Piping to Out-Null is used to block until finished @@ -196,6 +195,8 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, } } + $itemCount = @(Get-ChildItem "$destinationPartial").Count + if ($itemCount -eq 1) { Move-Item -Path "$destinationPartial\*" -Destination $output |
