Skip to content

Commit 7054c9d

Browse files
authored
fix(decompress): Use wix.exe in WiX Toolset v4+ as primary extractor of Expand-DarkArchive() (#5871)
1 parent 6327146 commit 7054c9d

3 files changed

Lines changed: 23 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
- **core:** Fix arguments parsing method of `Invoke-ExternalCommand()` ([#5839](https://github.com/ScoopInstaller/Scoop/issues/5839))
4949
- **scoop-alias:** Prevent overwrite existing file when adding alias ([#5577](https://github.com/ScoopInstaller/Scoop/issues/5577))
5050
- **scoop-virustotal:** Fix the issue that escape character not available in PowerShell 5.1 ([#5870](https://github.com/ScoopInstaller/Scoop/issues/5870))
51+
- **decompress:** Use `wix.exe` in WiX Toolset v4+ as primary extractor of `Expand-DarkArchive()` ([#5871](https://github.com/ScoopInstaller/Scoop/issues/5871))
5152
- **shim:** Run JAR file from app's root directory ([#5872](https://github.com/ScoopInstaller/Scoop/issues/5872))
5253

5354
### Performance Improvements

lib/core.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,9 @@ function Get-HelperPath {
427427
'Lessmsi' { $HelperPath = Get-AppFilePath 'lessmsi' 'lessmsi.exe' }
428428
'Innounp' { $HelperPath = Get-AppFilePath 'innounp' 'innounp.exe' }
429429
'Dark' {
430-
$HelperPath = Get-AppFilePath 'dark' 'dark.exe'
430+
$HelperPath = Get-AppFilePath 'wixtoolset' 'wix.exe'
431431
if ([String]::IsNullOrEmpty($HelperPath)) {
432-
$HelperPath = Get-AppFilePath 'wixtoolset' 'dark.exe'
432+
$HelperPath = Get-AppFilePath 'dark' 'dark.exe'
433433
}
434434
}
435435
'Aria2' { $HelperPath = Get-AppFilePath 'aria2' 'aria2c.exe' }

lib/decompress.ps1

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,32 @@ function Expand-DarkArchive {
279279
$Removal
280280
)
281281
$LogPath = "$(Split-Path $Path)\dark.log"
282-
$ArgList = @('-nologo', '-x', $DestinationPath, $Path)
282+
$DarkPath = Get-HelperPath -Helper Dark
283+
if ((Split-Path $DarkPath -Leaf) -eq 'wix.exe') {
284+
$ArgList = @('burn', 'extract', $Path, '-out', $DestinationPath, '-outba', "$DestinationPath\UX")
285+
} else {
286+
$ArgList = @('-nologo', '-x', $DestinationPath, $Path)
287+
}
283288
if ($Switches) {
284289
$ArgList += (-split $Switches)
285290
}
286-
$Status = Invoke-ExternalCommand (Get-HelperPath -Helper Dark) $ArgList -LogPath $LogPath
291+
$Status = Invoke-ExternalCommand $DarkPath $ArgList -LogPath $LogPath
287292
if (!$Status) {
288293
abort "Failed to extract files from $Path.`nLog file:`n $(friendly_path $LogPath)`n$(new_issue_msg $app $bucket 'decompress error')"
289294
}
295+
if (Test-Path "$DestinationPath\WixAttachedContainer") {
296+
Rename-Item "$DestinationPath\WixAttachedContainer" 'AttachedContainer' -ErrorAction Ignore
297+
} else {
298+
if (Test-Path "$DestinationPath\AttachedContainer\a0") {
299+
$Xml = [xml](Get-Content -Raw "$DestinationPath\UX\manifest.xml" -Encoding utf8)
300+
$Xml.BurnManifest.UX.Payload | ForEach-Object {
301+
Rename-Item "$DestinationPath\UX\$($_.SourcePath)" $_.FilePath -ErrorAction Ignore
302+
}
303+
$Xml.BurnManifest.Payload | ForEach-Object {
304+
Rename-Item "$DestinationPath\AttachedContainer\$($_.SourcePath)" $_.FilePath -ErrorAction Ignore
305+
}
306+
}
307+
}
290308
if (Test-Path $LogPath) {
291309
Remove-Item $LogPath -Force
292310
}

0 commit comments

Comments
 (0)