From 6d2e80ef33fba4e1e16a283fca83b2b949907282 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 3 Dec 2026 12:09:57 +0400 Subject: feat(cli): default game data to the working directory --- apps/fparkan-game/src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'apps/fparkan-game/src/main.rs') diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index cfae3ffb..2129f82c 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -11557,7 +11557,11 @@ impl Args { _ => return Err(usage()), } } - let root = root.ok_or_else(|| "missing --root".to_string())?; + let root = match root { + Some(root) => root, + None => std::env::current_dir() + .map_err(|error| format!("cannot resolve the game data directory: {error}"))?, + }; let mission = match (list_missions, mission) { (true, None) if sim_report_ms.is_none() => String::new(), (true, _) => { @@ -11612,7 +11616,7 @@ impl Args { } fn usage() -> String { - "usage: fparkan-game --root --list-missions\n fparkan-game --root --mission --sim-report \n fparkan-game --root --mission [--build-scheme [--build-part OLD=NEW]...] [--viewer] [--frames ] [--atmosphere-seconds ] [--control-clock-ms ] [--validation] [--preview-roots ] [--legacy-camera-capture ] [--static-animation-frame ] [--static-material-phase ] [--readback-out ] [--readback-sequence-out ]\n--viewer skips mission simulation. Capture, static pose/material and root-limit options select viewer mode. --control-clock-ms replays the scene clock from zero to the selected time over the requested frames; --readback-sequence-out captures each submitted frame and requires that clock.".to_string() + "usage: fparkan-game [--root ] --list-missions\n fparkan-game [--root ] --mission --sim-report \n fparkan-game [--root ] --mission [--build-scheme [--build-part OLD=NEW]...] [--viewer] [--frames ] [--atmosphere-seconds ] [--control-clock-ms ] [--validation] [--preview-roots ] [--legacy-camera-capture ] [--static-animation-frame ] [--static-material-phase ] [--readback-out ] [--readback-sequence-out ]\nWithout --root, game data is read from the working directory.\n--viewer skips mission simulation. Capture, static pose/material and root-limit options select viewer mode. --control-clock-ms replays the scene clock from zero to the selected time over the requested frames; --readback-sequence-out captures each submitted frame and requires that clock.".to_string() } #[cfg(test)] -- cgit v1.2.3