core: show data_dir in config and check its asset policy

'victory config' displays game_dir, cache_dir, and test_titles, but omitted data_dir (where saves, persistent local storage, and crashes.log are stored). It also omitted data_dir from the runtime asset-policy check loop in show_config().

Include data_dir in the output and policy check, and add a unit test in victory-core asserting that a data_dir inside the repository is refused.
This commit is contained in:
Advait Palve committed 2026-11-24 10:56:10 +05:30
1 parent d2a4bae1f4
commit 9a8908c378
2 files changed
+12 -1

No files matched your search

+2 -1
View File
@@ -180,6 +180,7 @@ fn show_config() -> Result<()> {
);
println!("game_dir : {}", status(&cfg.game_dir));
println!("cache_dir : {}", cfg.cache_dir.display());
println!("data_dir : {}", cfg.data_dir.display());
for t in &cfg.test_titles {
println!("test_title : {}", status(&Some(t.clone())));
}
@@ -187,7 +188,7 @@ fn show_config() -> Result<()> {
.game_dir
.iter()
.chain(&cfg.test_titles)
.chain([&cfg.cache_dir])
.chain([&cfg.cache_dir, &cfg.data_dir])
{
if let Err(e) = victory_core::ensure_outside_repo(p) {
println!("POLICY VIOLATION: {e}");
+10
View File
@@ -181,4 +181,14 @@ mod tests {
};
assert!(cfg.cache_subdir("x").is_err());
}
#[test]
fn data_inside_repo_is_refused() {
let inside = Path::new(env!("CARGO_MANIFEST_DIR")).join("data");
let cfg = Config {
data_dir: inside,
..Default::default()
};
assert!(cfg.data_subdir("x").is_err());
}
}