diff --git a/pack-dist.ps1 b/pack-dist.ps1 index 9e76214..18ae6a2 100644 --- a/pack-dist.ps1 +++ b/pack-dist.ps1 @@ -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)" }