Skip to content

Commit

Permalink
fix(decompress): Check .zst first
Browse files Browse the repository at this point in the history
And also trim `\` in `-DestinationPath`
  • Loading branch information
niheaven committed Nov 10, 2021
1 parent af7a6f6 commit e35ff31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/decompress.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ function Expand-ZstdArchive {
)
$ZstdPath = Get-HelperPath -Helper Zstd
$LogPath = "$(Split-Path $Path)\zstd.log"
$DestinationPath = $DestinationPath.TrimEnd("\")
ensure $DestinationPath | Out-Null
$ArgList = @('-d', "`"$Path`"", '--output-dir-flat', "`"$DestinationPath`"")
$ArgList = @('-d', "`"$Path`"", '--output-dir-flat', "`"$DestinationPath`"", "-v")
if ($Switches) {
$ArgList += (-split $Switches)
}
Expand All @@ -164,7 +165,7 @@ function Expand-ZstdArchive {
}
if ($IsTar) {
# Check for tar
$TarFile = Get-ChildItem -Path $DestinationPath -Filter '*.tar'
$TarFile = (strip_ext $Path)
Expand-7zipArchive -Path "$TarFile" -DestinationPath $DestinationPath -ExtractDir $ExtractDir -Removal
}
if ($Removal) {
Expand Down
4 changes: 2 additions & 2 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,10 @@ function dl_urls($app, $version, $manifest, $bucket, $architecture, $dir, $use_c
} else {
$extract_fn = 'Expand-MsiArchive'
}
} elseif(Test-ZstdRequirement -File $fname) { # Zstd first
$extract_fn = 'Expand-ZstdArchive'
} elseif(Test-7zipRequirement -File $fname) { # 7zip
$extract_fn = 'Expand-7zipArchive'
} elseif(Test-ZstdRequirement -File $fname) { # Zstd
$extract_fn = 'Expand-ZstdArchive'
}

if($extract_fn) {
Expand Down

0 comments on commit e35ff31

Please sign in to comment.