Skip to content

Commit

Permalink
(GH-676) Fix: Unzip specific folder feature is broken
Browse files Browse the repository at this point in the history
Previously, when attempting to unzip a subdirectory in a zipped
archive, the Chocolatey unzip functions were ignoring the `SpecificFolder`
parameter. This was caused by a change to use 7za.exe in August 2013 in commit
chocolatey-archive/chocolatey@2e83d2e.

That changed carried over into the newer codebase. More recently there was a
switch back to 7z.exe (full 7zip), so it is possible to unzip a subdirectory
in an archive again. Ensure that `SpecficFolder` is added to the 7zip options
when it is specified.
  • Loading branch information
DarwinJS authored and ferventcoder committed Mar 17, 2017
1 parent e991fbc commit 3b13869
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ param(
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)
$zipfileFullPath=$fileFullPath
if ($specificfolder) {
$fileFullPath=join-path $fileFullPath $specificFolder
}

Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters

Expand Down Expand Up @@ -123,6 +120,9 @@ param(
}

$params = "x -aoa -bd -bb1 -o`"$destinationNoRedirection`" -y `"$fileFullPathNoRedirection`""
if ($specificfolder) {
$params += " `"$specificfolder`""
}
Write-Debug "Executing command ['$7zip' $params]"

# Capture 7z's output into a StringBuilder and write it out in blocks, to improve I/O performance.
Expand Down

0 comments on commit 3b13869

Please sign in to comment.