From 147cde8bfda4e7283e4d47cd8a55c5bd0c689081 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 17 Oct 2017 13:19:42 -0700 Subject: [fetchDependency] Use Expand-Archive if it exists, otherwise fallback to cmd --- scripts/fetchDependency.ps1 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index ac4ab5f46..6024895ae 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -101,12 +101,19 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) New-Item -ItemType Directory -Path $destination | Out-Null } - $shell = new-object -com shell.application - $zip = $shell.NameSpace($file) - foreach($item in $zip.items()) + if (Test-Command -commandName 'Expand-Archive') { - # Piping to Out-Null is used to block until finished - $shell.Namespace($destination).copyhere($item) | Out-Null + Expand-Archive -path $file -destinationpath $destination + } + else + { + $shell = new-object -com shell.application + $zip = $shell.NameSpace($file) + foreach($item in $zip.items()) + { + # Piping to Out-Null is used to block until finished + $shell.Namespace($destination).copyhere($item) | Out-Null + } } } -- cgit v1.2.3