aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-11-05 17:58:47 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2017-11-05 17:58:47 -0800
commit524adf93aac0b7ed7c9c0f06d0e578803336bbb7 (patch)
treeb947c39aac774e42b4040df11244d57be9cf633f /scripts
parent330b8d8bab6a3d07165bf7c05fea09a8e0d56348 (diff)
downloadvcpkg-524adf93aac0b7ed7c9c0f06d0e578803336bbb7.tar.gz
vcpkg-524adf93aac0b7ed7c9c0f06d0e578803336bbb7.zip
[Expand-Archive] Use namespaces to distringuish Powershell 5's and PSCX's
Diffstat (limited to 'scripts')
-rw-r--r--scripts/fetchDependency.ps112
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1
index 16ba984e6..4f629dfc9 100644
--- a/scripts/fetchDependency.ps1
+++ b/scripts/fetchDependency.ps1
@@ -142,12 +142,19 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
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
{
+ Write-Verbose("Extracting via shell")
$shell = new-object -com shell.application
$zip = $shell.NameSpace($file)
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
{
- # Expand-Archive $downloadPath -dest "$extractionFolder" -Force # Requires powershell 5+
Expand-ZIPFile -File $downloadPath -Destination $extractionFolder
}
}