Config: ignore an empty VICTORY_CONFIG #363
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/363"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by enzoduarte1 on 2026-11-24T02:36:53Z.
What
Config::loadtreats an emptyVICTORY_CONFIGas an explicit path:PathBuf::from("")is not a file, so startup fails withVICTORY_CONFIG points at , which does not exist. The other path variables inresolveignore empty values; PR #341 makesVICTORY_TEST_TITLESconsistent with them.The environment lookup now goes through a small helper that filters empty values, so
VICTORY_CONFIG=falls back to./victory.toml(or no config file) instead of aborting. A non-empty value still selects that exact file. A unit test covers empty and non-empty values.Tested
x86_64-pc-windows-gnu(this machine has no MSVC linker).cargo test -p victory-core: 9 passed, 0 failed.cargo test --workspace --exclude victory-loader: all suites passed.cargo clippy -p victory-core --all-targets -- -D warnings: clean.cargo clippy --workspace --all-targets: finishes successfully; it still reports the pre-existing warnings that PR #355 fixes.rustfmt --edition 2024 --check crates/victory-core/src/config.rsandgit diff --check: clean.cargo xtask policy: 151 files ok. No game files or data taken from them were added.cargo test -p victory-loader --test load_probe. Its fixture passes MSVC's/DELAYLOADlink flag, which MinGW's linker rejects here; the same failure occurs on unmodifiedmain.cargo fmt --all --checkalso has unrelated pre-existing diffs, so no other files were reformatted.Checklist
cargo fmt,cargo clippy --workspace --all-targetsandcargo test --workspacepass — see the toolchain limitations above; the changed crate is clean.cargo xtask policypasses. The change adds no game files or data taken from them (docs/asset-policy.md).Imported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T03:06:45Z.
Thanks for this. The bug is real: on
main,VICTORY_CONFIG=is turned intoPathBuf::from(""), and startup stops withVICTORY_CONFIG points at , which does not exist. The fix is right too.What I checked
4874c3f), Linux,cargo test -p victory-core config: 5 passed, including the newempty_config_env_is_ignored.resolvedoes, so the test doesn't change the process environment. Good.This overlaps with #241
#241 (Core host UX: XDG data dir, config-relative paths) already has this fix. Its
explicit_configdoes the same.filter(|v| !v.is_empty())onVICTORY_CONFIG, and the module docs now say "a variable that is set but empty counts as unset". Its testvictory_config_expands_tilde_and_ignores_emptycovers the empty value. It also expands a leading~and gives a clearer error when the value names a folder.The two PRs change the same lines of
Config::load, so merging one gives the other a conflict incrates/victory-core/src/config.rs. I checked this with a trial merge.Suggestion
Either way, nothing needs to change in this PR.
Imported from Marvisak/VIctory. Originally posted by enzoduarte1 on 2026-11-24T03:34:54Z.
Thanks for checking this. Agreed: if PR 241 lands first, this change is redundant and can be closed; otherwise it can land on its own and PR 241 can drop its copy of the filter. I will leave the call to the maintainers — nothing needs changing here.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T07:37:39Z.
Review: APPROVED
Tested
4874c3fon Windows 11, RTX 5070, MSVC:cargo test --workspace --no-fail-fastpasses (265 passed, 0 failed).An empty
VICTORY_CONFIGnow means unset, the same rule the other path variables inresolvealready follow (env_pathfilters empty values). A non-empty value is still taken as the exact file, so a mistyped path still fails loudly. The helper takes the env lookup as a closure, matching howresolveis tested.No issues found.
AI-assisted (Claude Code).