pack-dist: refuse to repack while the game runs from dist

Remove-Item raced a live playtest session and gutted the folder around
the locked files. Detect a running rpl4opt.exe under dist and abort
before deleting anything.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-12 15:13:12 -05:00
co-authored by Claude Fable 5
parent 4037e39810
commit 6a06187d38
+7
View File
@@ -27,6 +27,13 @@ if (-not (Test-Path $exe)) {
throw "Release\rpl4opt.exe not found - build first (see BUILD.md 2)." throw "Release\rpl4opt.exe not found - build first (see BUILD.md 2)."
} }
# Refuse to touch a dist the game is currently running from.
$running = Get-Process rpl4opt -ErrorAction SilentlyContinue |
Where-Object { $_.Path -like "$dist\*" }
if ($running) {
throw "rpl4opt.exe is running from $dist (PID $($running.Id)) - close the game first."
}
Write-Host "Packing into $dist" Write-Host "Packing into $dist"
if (Test-Path $dist) { Remove-Item -Recurse -Force $dist } if (Test-Path $dist) { Remove-Item -Recurse -Force $dist }
New-Item -ItemType Directory -Force "$dist\SPOOLS" | Out-Null New-Item -ItemType Directory -Force "$dist\SPOOLS" | Out-Null