From 6a06187d385cb2f818edda8251f6cbada8053415 Mon Sep 17 00:00:00 2001 From: Cyd Date: Sun, 12 Jul 2026 15:13:12 -0500 Subject: [PATCH] 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 --- pack-dist.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pack-dist.ps1 b/pack-dist.ps1 index 15210dd..cbac0fe 100644 --- a/pack-dist.ps1 +++ b/pack-dist.ps1 @@ -27,6 +27,13 @@ if (-not (Test-Path $exe)) { 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" if (Test-Path $dist) { Remove-Item -Recurse -Force $dist } New-Item -ItemType Directory -Force "$dist\SPOOLS" | Out-Null