From e3099b458b5c11742c1b88c27847801090870f2d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 4 Apr 2018 19:26:14 -0700 Subject: [PATCH] Use 7zip920 instead of 7zr --- scripts/VcpkgPowershellUtils.ps1 | 19 +++++++++++++++++++ scripts/fetchTool.ps1 | 14 +++++++++----- scripts/vcpkgTools.xml | 11 ++++++----- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index 7082ca747..d7967889e 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -198,6 +198,25 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$sevenZipExe, Rename-Item -Path "$destinationPartial" -NewName $destinationDir } +function vcpkgExtractZipFileWithShell( [Parameter(Mandatory=$true)][string]$archivePath, + [Parameter(Mandatory=$true)][string]$destinationDir) +{ + vcpkgRemoveItem $destinationDir + $destinationPartial = "$destinationDir.partial" + vcpkgRemoveItem $destinationPartial + vcpkgCreateDirectoryIfNotExists $destinationPartial + + $shell = new-object -com shell.application + $zip = $shell.NameSpace($(Get-Item $archivePath).fullname) + foreach($item in $zip.items()) + { + # Piping to Out-Null is used to block until finished + $shell.Namespace($destinationPartial).copyhere($item) | Out-Null + } + + Rename-Item -Path "$destinationPartial" -NewName $destinationDir +} + function vcpkgInvokeCommand() { param ( [Parameter(Mandatory=$true)][string]$executable, diff --git a/scripts/fetchTool.ps1 b/scripts/fetchTool.ps1 index 05335c724..e46c7808d 100644 --- a/scripts/fetchTool.ps1 +++ b/scripts/fetchTool.ps1 @@ -48,8 +48,8 @@ function fetchToolInternal([Parameter(Mandatory=$true)][string]$tool) { Write-Host "Downloading $tool..." - # aria2 needs 7zip & 7zr to extract. So, we need to download those trough powershell - if ($tool -eq "aria2" -or $tool -eq "7zip" -or $tool -eq "7zr") + # aria2 needs 7zip & 7zip920 to extract. So, we need to download those trough powershell + if ($tool -eq "aria2" -or $tool -eq "7zip" -or $tool -eq "7zip920") { vcpkgDownloadFile $url $downloadPath } @@ -69,10 +69,14 @@ function fetchToolInternal([Parameter(Mandatory=$true)][string]$tool) if ($isArchive) { Write-Host "Extracting $tool..." - if ($tool -eq "7zip") + if ($tool -eq "7zip920") { - $sevenZipR = fetchToolInternal "7zr" - $ec = vcpkgInvokeCommand "$sevenZipR" "x `"$downloadPath`" -o`"$toolPath`" -y" + vcpkgExtractZipFileWithShell -ArchivePath $downloadPath -DestinationDir $toolPath + } + elseif ($tool -eq "7zip") + { + $sevenZip920 = fetchToolInternal "7zip920" + $ec = vcpkgInvokeCommand "$sevenZip920" "x `"$downloadPath`" -o`"$toolPath`" -y" if ($ec -ne 0) { Write-Host "Could not extract $downloadPath" diff --git a/scripts/vcpkgTools.xml b/scripts/vcpkgTools.xml index fe1cc12a9..810818998 100644 --- a/scripts/vcpkgTools.xml +++ b/scripts/vcpkgTools.xml @@ -54,11 +54,12 @@ 9371df22bcd0e1aff9eaa52aa3292350eecd011f11494e709314ae3f3eb279e2 7z1801-extra.7z - - 18.01.0 - 7zr.exe - https://www.7-zip.org/a/7zr.exe - 2c7a8709260e0295a2a3cfd5a8ad0459f37490ed1794ea68bf85a6fab362553b + + 9.20.0 + 7za.exe + https://www.7-zip.org/a/7za920.zip + 2a3afe19c180f8373fa02ff00254d5394fec0349f5804e0ad2f6067854ff28ac + 7za920.zip 18.01.0