Harden player bats: location guard for 'cannot find path specified'

Field report: a remote player ran join.bat from the wrong place (inside
the zip, or the .bat separated from content\/build\) and got 'The system
cannot find the path specified' + dumps -- the relative 'cd %~dp0content'
failed cryptically.

Now each bat: cd to its own dir, verify build\Release\btl4.exe +
content\<egg> exist, else jump to :badpath and print a clear message
('this file must sit in the extracted folder next to content and build;
right-click the zip - Extract All and run it from there').  Verified: run
from a dir with no content/build -> the guidance prints, no dump.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-18 19:16:38 -05:00
co-authored by Claude Fable 5
parent 9690043e57
commit 0b83d71578
4 changed files with 123 additions and 47 deletions
+59 -36
View File
@@ -755,47 +755,70 @@ class Operator(QMainWindow):
# first-come-first-served (no BT_SELF), so every player gets the SAME
# file -- who flies which mech is whoever sits down first, exactly
# like walking up to a pod.
tail = ("echo.\n"
"echo The game has exited. If you did NOT quit on purpose\n"
"echo (crash, or it never connected), send the operator the\n"
"echo file content\\join.log so they can see what happened.\n"
"echo Otherwise the session may not be up yet -- try again.\n"
"pause\n")
# LOCATION GUARD (field report 2026-07-18: 'cannot find path specified'
# + dumps): the bat MUST sit in the extracted folder next to content\
# and build\. Running it from inside the zip (or after moving just the
# .bat) broke the relative cd with a cryptic error. Check first and
# give a clear message instead.
def guarded(header, sets, run, tail):
return ("@echo off\n" + header +
"cd /d %~dp0\n"
"if not exist \"build\\Release\\btl4.exe\" goto badpath\n"
"if not exist \"content\\" + egg_name +
"\" goto badpath\n" +
sets +
"cd content\n" + run + tail +
"exit /b\n"
":badpath\n"
"echo.\n"
"echo ==================================================\n"
"echo ERROR: this file is not in the right place.\n"
"echo.\n"
"echo It must sit in the EXTRACTED game folder, next to\n"
"echo the 'content' and 'build' folders.\n"
"echo.\n"
"echo Fix: right-click the .zip - Extract All, open the\n"
"echo extracted folder, and run this file from THERE.\n"
"echo (Do NOT run it from inside the zip.)\n"
"echo ==================================================\n"
"echo.\n"
"pause\n")
net_tail = ("echo.\n"
"echo The game has exited. If you did NOT quit on purpose\n"
"echo (crash, or it never connected), send the operator the\n"
"echo file content\\join.log so they can see what "
"happened.\n"
"echo Otherwise the session may not be up yet -- try "
"again.\n"
"pause\n")
with open(os.path.join(out_dir, "join.bat"), "w", newline="\r\n") as f:
f.write("@echo off\n"
"rem BT411 -- join %s's game (internet). Your seat/mech\n"
"rem is assigned automatically by the operator console.\n"
"set BT_RELAY=%s:%d\n"
"set BT_LOG=join.log\n"
"cd /d %%~dp0content\n"
"..\\build\\Release\\btl4.exe -egg %s -net 1501\n"
% (host, host, self.f_port.value(), egg_name) + tail)
f.write(guarded(
"rem BT411 -- join %s's game (internet). Seat/mech assigned\n"
"rem by the operator. Keep this file next to content\\ + "
"build\\.\n" % host,
"set BT_RELAY=%s:%d\nset BT_LOG=join.log\n"
% (host, self.f_port.value()),
"..\\build\\Release\\btl4.exe -egg %s -net 1501\n" % egg_name,
net_tail))
with open(os.path.join(out_dir, "join_lan.bat"), "w",
newline="\r\n") as f:
f.write("@echo off\n"
"rem BT411 -- join the game from the operator's OWN\n"
"rem network (LAN) -- finds the console automatically.\n"
"rem Joining over the INTERNET? Use join.bat instead.\n"
"set BT_RELAY=auto\n"
"set BT_LOG=join.log\n"
"cd /d %%~dp0content\n"
"..\\build\\Release\\btl4.exe -egg %s -net 1501\n"
% egg_name + tail)
# solo practice: no server involved -- the game self-launches a
# single-player mission (no -net argument = no console wait)
f.write(guarded(
"rem BT411 -- join the operator's LAN game (auto-discovers).\n"
"rem Joining over the INTERNET? Use join.bat instead.\n",
"set BT_RELAY=auto\nset BT_LOG=join.log\n",
"..\\build\\Release\\btl4.exe -egg %s -net 1501\n" % egg_name,
net_tail))
with open(os.path.join(out_dir, "play_solo.bat"), "w",
newline="\r\n") as f:
f.write("@echo off\n"
"rem BT411 -- single-player practice mission (no network,\n"
"rem no operator needed). Edit the -egg name below to try\n"
"rem other maps (ARENA1/ARENA2/DBASE/FOGDAY/...).\n"
"set BT_START_INSIDE=1\n"
"cd /d %~dp0content\n"
"..\\build\\Release\\btl4.exe -egg ARENA1.EGG\n"
"echo.\n"
"echo The game has exited. If it closed unexpectedly,\n"
"echo send the operator the file content\\btl4.log.\n"
"pause\n")
f.write(guarded(
"rem BT411 -- single-player practice (no network, no "
"operator).\n"
"rem Edit the -egg below for other maps "
"(ARENA2/DBASE/FOGDAY/...).\n",
"set BT_START_INSIDE=1\nset BT_LOG=join.log\n",
"..\\build\\Release\\btl4.exe -egg ARENA1.EGG\n",
"echo.\necho The game has exited. If it closed unexpectedly,\n"
"echo send the operator content\\join.log.\npause\n"))
self.log.appendPlainText(
"exported join.bat + join_lan.bat + play_solo.bat to %s "
"(public host: %s) -- join bats are universal; the relay "