mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-24 11:37:12 +01:00
[Expand-Archive] Use namespaces to distringuish Powershell 5's and PSCX's
This commit is contained in:
parent
330b8d8bab
commit
524adf93aa
@ -142,12 +142,19 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
|
|||||||
New-Item -ItemType Directory -Path $destination | Out-Null
|
New-Item -ItemType Directory -Path $destination | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Test-Command -commandName 'Expand-Archive')
|
if (Test-Command -commandName 'Microsoft.PowerShell.Archive\Expand-Archive')
|
||||||
{
|
{
|
||||||
Expand-Archive -path $file -destinationpath $destination
|
Write-Verbose("Extracting with Microsoft.PowerShell.Archive\Expand-Archive")
|
||||||
|
Microsoft.PowerShell.Archive\Expand-Archive -path $file -destinationpath $destination
|
||||||
|
}
|
||||||
|
elseif (Test-Command -commandName 'Pscx\Expand-Archive')
|
||||||
|
{
|
||||||
|
Write-Verbose("Extracting with Pscx\Expand-Archive")
|
||||||
|
Pscx\Expand-Archive -path $file -OutputPath $destination
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Write-Verbose("Extracting via shell")
|
||||||
$shell = new-object -com shell.application
|
$shell = new-object -com shell.application
|
||||||
$zip = $shell.NameSpace($file)
|
$zip = $shell.NameSpace($file)
|
||||||
foreach($item in $zip.items())
|
foreach($item in $zip.items())
|
||||||
@ -257,7 +264,6 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
|
|||||||
{
|
{
|
||||||
if (-not (Test-Path $executableFromDownload)) # consider renaming the extraction folder to make sure the extraction finished
|
if (-not (Test-Path $executableFromDownload)) # consider renaming the extraction folder to make sure the extraction finished
|
||||||
{
|
{
|
||||||
# Expand-Archive $downloadPath -dest "$extractionFolder" -Force # Requires powershell 5+
|
|
||||||
Expand-ZIPFile -File $downloadPath -Destination $extractionFolder
|
Expand-ZIPFile -File $downloadPath -Destination $extractionFolder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user