aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2018-03-11 23:03:18 -0700
committerRobert Schumacher <roschuma@microsoft.com>2018-03-11 23:42:53 -0700
commit7aaa59fc9d7b814fc6cabd369e9f148f381ffe59 (patch)
treec887fc69197377630d3c5d30c3be78d91242c57c /scripts
parenta773c59f05ddfbe3fd68517ed4c91aa179e57f89 (diff)
downloadvcpkg-7aaa59fc9d7b814fc6cabd369e9f148f381ffe59.tar.gz
vcpkg-7aaa59fc9d7b814fc6cabd369e9f148f381ffe59.zip
[vcpkg] Fix extracting on Windows Server Core. Related to #2518.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/VcpkgPowershellUtils.ps18
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1
index 2dbf04085..73a3fc9ad 100644
--- a/scripts/VcpkgPowershellUtils.ps1
+++ b/scripts/VcpkgPowershellUtils.ps1
@@ -172,10 +172,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 +185,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 +194,8 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file,
}
}
+ $itemCount = @(Get-ChildItem "$destinationPartial").Count
+
if ($itemCount -eq 1)
{
Move-Item -Path "$destinationPartial\*" -Destination $output