mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-19 02:33:02 +08:00
[vcpkg] Fix extracting on Windows Server Core. Related to #2518.
This commit is contained in:
parent
a773c59f05
commit
7aaa59fc9d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user