feat(gameengine): auto-detect Steam game data via ${env:VAR} placeholders

Workflow JSON params can now reference environment variables (e.g.
${env:QUAKE3_PAK0}) which are expanded at JSON load time. A new Python
detector reads the Windows registry and parses libraryfolders.vdf to
locate Steam libraries, then resolves known-game files into env vars
that dev_commands.py exports before launching the engine. Lets users
with legitimate Steam-owned game data run packages like quake3 without
hardcoded paths.

Also fixes os.execv on Windows (Invalid argument with spaced paths) by
falling back to subprocess.call.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-30 14:58:29 +01:00
parent 2d3715c5ff
commit d9af1fb5bf
5 changed files with 249 additions and 8 deletions
+21 -1
View File
@@ -640,6 +640,22 @@ def run_demo(args: argparse.Namespace) -> None:
if not args.no_sync:
_sync_assets(build_dir, args.dry_run)
# Detect Steam-owned game data and export as env vars for ${env:VAR}
# substitution in workflow JSON. Silent no-op if Steam isn't installed.
try:
from steam_detector import detect_and_export
detected = detect_and_export()
if detected:
print("=== Detected game data ===")
for k, v in detected.items():
print(f" {k}={v}")
os.environ[k] = v
print()
except NotImplementedError as e:
print(f"[steam_detector] {e}")
except Exception as e:
print(f"[steam_detector] detection skipped: {e}")
exe_name = args.target or ("sdl3_app.exe" if IS_WINDOWS else "sdl3_app")
binary = str(Path(build_dir).resolve() / exe_name)
run_args = _strip_leading_double_dash(args.args)
@@ -647,8 +663,12 @@ def run_demo(args: argparse.Namespace) -> None:
if run_args:
cmd.extend(run_args)
_print_cmd(cmd)
import os
os.chdir(build_dir)
if IS_WINDOWS:
# os.execv is buggy on Windows with paths containing spaces;
# use subprocess and propagate the exit code instead.
import subprocess
sys.exit(subprocess.call(cmd))
os.execv(binary, cmd)