Zipping a release no longer costs you your own settings

The file-preserving repack landed with the restore before the zip and
skipped entirely under -Zip, to keep somebody's callsign and key
bindings out of a release. It worked, but at the price of -Zip quietly
wiping the settings out of dist\ - captured, then discarded.

Both properties are available at once by moving the restore after the
archive is taken: the zip is built from a folder with none of the
player's files in it, and they go back into dist\ immediately
afterwards. A fresh unzip still looks like a first run, and cutting a
release costs the person cutting it nothing.

Verified: edited all four files, packed with -Zip, and confirmed the
archive contains none of them - 1003 entries, nothing loose at the root -
while all four are still in dist\ with their edits intact.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-08-05 16:02:13 -05:00
co-authored by Claude Opus 5
parent a0a0ad51d1
commit 8ba2d4fc86
+15 -16
View File
@@ -289,22 +289,6 @@ glass may appear rotated.
Source: https://gitea.mysticmachines.com/VWE/RP412
"@
# --- the player's own files, back where they were --------------------------
# Last, so the rebuilt tree cannot overwrite them. The zip below is taken
# from dist\, so a preserved file would otherwise travel to whoever gets the
# package - hence the copies are put back only when we are NOT zipping, and a
# release is always built from a folder with none of them in it.
if ($kept.Count -gt 0) {
if ($Zip) {
Write-Host " -Zip: leaving $($kept.Keys -join ', ') out, so the release ships clean"
} else {
foreach ($name in $kept.Keys) {
[System.IO.File]::WriteAllBytes((Join-Path $dist $name), $kept[$name])
}
Write-Host " restored $($kept.Keys -join ', ')"
}
}
# --- summary / optional zip ------------------------------------------------
$size = (Get-ChildItem $dist -Recurse | Measure-Object Length -Sum).Sum
Write-Host ("dist ready: {0:N1} MB" -f ($size / 1MB))
@@ -313,6 +297,10 @@ if ($Zip) {
$zipPath = Join-Path $root "RedPlanet-$version.zip"
Write-Host "zipping to $zipPath..."
# Taken BEFORE the player's files go back, so a release never carries
# somebody's callsign, key bindings or window positions to everyone who
# downloads it. A fresh unzip must look like a first run.
#
# Everything lives under a single RP412\ folder inside the zip, so
# unpacking anywhere gives one self-contained game directory instead
# of scattering files into the extraction folder.
@@ -323,3 +311,14 @@ if ($Zip) {
Compress-Archive -Path "$stage\RP412" -DestinationPath $zipPath -Force
Remove-Item -Recurse -Force $stage
}
# --- the player's own files, back where they were --------------------------
# Last of all: after the rebuilt tree, so nothing the pack writes can land on
# top of them, and after the zip, so the release stays clean. Zipping should
# not cost you your own settings.
if ($kept.Count -gt 0) {
foreach ($name in $kept.Keys) {
[System.IO.File]::WriteAllBytes((Join-Path $dist $name), $kept[$name])
}
Write-Host " restored $($kept.Keys -join ', ')"
}