Use 7zip920 instead of 7zr

This commit is contained in:
Alexander Karatarakis 2018-04-04 19:26:14 -07:00
parent 0c0f68939e
commit e3099b458b
3 changed files with 34 additions and 10 deletions

View File

@ -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,

View File

@ -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"

View File

@ -54,11 +54,12 @@
<sha256>9371df22bcd0e1aff9eaa52aa3292350eecd011f11494e709314ae3f3eb279e2</sha256>
<archiveRelativePath>7z1801-extra.7z</archiveRelativePath>
</tool>
<tool name="7zr">
<requiredVersion>18.01.0</requiredVersion>
<exeRelativePath>7zr.exe</exeRelativePath>
<url>https://www.7-zip.org/a/7zr.exe</url>
<sha256>2c7a8709260e0295a2a3cfd5a8ad0459f37490ed1794ea68bf85a6fab362553b</sha256>
<tool name="7zip920">
<requiredVersion>9.20.0</requiredVersion>
<exeRelativePath>7za.exe</exeRelativePath>
<url>https://www.7-zip.org/a/7za920.zip</url>
<sha256>2a3afe19c180f8373fa02ff00254d5394fec0349f5804e0ad2f6067854ff28ac</sha256>
<archiveRelativePath>7za920.zip</archiveRelativePath>
</tool>
<tool name="aria2">
<requiredVersion>18.01.0</requiredVersion>