Pack: wrap the dist zip in a single BT412/ folder

The zip previously stored files at the root (Compress-Archive -Path dist\*),
so extracting spilled loose files into the extraction directory. Build the
archive with .NET's ZipFile and prefix every entry with BT412/, so it extracts
into one self-contained BT412\ folder. Local staging dir stays dist\.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-17 11:06:52 -05:00
co-authored by Claude Opus 4.8
parent a3ee609cde
commit 0434585566
+19 -3
View File
@@ -253,8 +253,24 @@ Write-Host ("dist ready: {0:N1} MB -> $dist" -f ($size / 1MB))
if ($Zip) {
$zipPath = Join-Path $root 'BattleTech-4.12.zip'
Write-Host "zipping to $zipPath..."
Write-Host "zipping to $zipPath (wrapped in a BT412\ folder)..."
if (Test-Path $zipPath) { Remove-Item -Force $zipPath }
Compress-Archive -Path "$dist\*" -DestinationPath $zipPath -Force
Write-Host "zip ready: $zipPath"
# Every entry is prefixed BT412/ so the archive extracts into ONE folder
# (rather than spilling loose files into the extraction directory). Built
# with .NET's ZipFile so the prefix is explicit, independent of the local
# staging dir's name.
Add-Type -AssemblyName System.IO.Compression.FileSystem
$base = (Resolve-Path $dist).Path.TrimEnd('\')
$archive = [System.IO.Compression.ZipFile]::Open($zipPath, 'Create')
try {
Get-ChildItem -LiteralPath $dist -Recurse -File | ForEach-Object {
$rel = $_.FullName.Substring($base.Length + 1) -replace '\\', '/'
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile(
$archive, $_.FullName, "BT412/$rel",
[System.IO.Compression.CompressionLevel]::Optimal) | Out-Null
}
} finally {
$archive.Dispose()
}
Write-Host "zip ready: $zipPath (extracts to a single BT412\ folder)"
}