Config: ignore an empty VICTORY_CONFIG #363

Manually merged
github merged 1 commit from gh-pr/363/head into gh-pr/363/base 2026-11-26 04:00:58 +00:00
Owner

@⁠enzoduarte1 on GitHub · 2026-11-24 02:36 UTC · original
enzoduarte1:config/empty-config-env → main · +20 −1 · 1 files · 1 commits · merged 2026-11-25 00:19 UTC

What

Config::load treats an empty VICTORY_CONFIG as an explicit path: PathBuf::from("") is not a file, so startup fails with VICTORY_CONFIG points at , which does not exist. The other path variables in resolve ignore empty values; PR #341 makes VICTORY_TEST_TITLES consistent 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

  • Windows 11, Rust 1.98.1, 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.rs and git diff --check: clean.
  • cargo xtask policy: 151 files ok. No game files or data taken from them were added.
  • Not tested: cargo test -p victory-loader --test load_probe. Its fixture passes MSVC's /DELAYLOAD link flag, which MinGW's linker rejects here; the same failure occurs on unmodified main. cargo fmt --all --check also has unrelated pre-existing diffs, so no other files were reformatted.

Checklist

  • cargo fmt, cargo clippy --workspace --all-targets and cargo test --workspace pass — see the toolchain limitations above; the changed crate is clean.
  • cargo xtask policy passes. The change adds no game files or data taken from them (docs/asset-policy.md).
  • If an AI tool wrote part of this change, the description says so: an AI tool assisted with the code and test; I reviewed and ran them.
**@⁠enzoduarte1** on GitHub · 2026-11-24 02:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/363) `enzoduarte1:config/empty-config-env` → `main` · +20 −1 · 1 files · 1 commits · merged 2026-11-25 00:19 UTC ## What `Config::load` treats an empty `VICTORY_CONFIG` as an explicit path: `PathBuf::from("")` is not a file, so startup fails with `VICTORY_CONFIG points at , which does not exist`. The other path variables in `resolve` ignore empty values; PR #341 makes `VICTORY_TEST_TITLES` consistent 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 - Windows 11, Rust 1.98.1, `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.rs` and `git diff --check`: clean. - `cargo xtask policy`: 151 files ok. No game files or data taken from them were added. - Not tested: `cargo test -p victory-loader --test load_probe`. Its fixture passes MSVC's `/DELAYLOAD` link flag, which MinGW's linker rejects here; the same failure occurs on unmodified `main`. `cargo fmt --all --check` also has unrelated pre-existing diffs, so no other files were reformatted. ## Checklist - [ ] `cargo fmt`, `cargo clippy --workspace --all-targets` and `cargo test --workspace` pass — see the toolchain limitations above; the changed crate is clean. - [x] `cargo xtask policy` passes. The change adds no game files or data taken from them (`docs/asset-policy.md`). - [x] If an AI tool wrote part of this change, the description says so: an AI tool assisted with the code and test; I reviewed and ran them.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:00:58 +00:00
github manually merged commit fd44561ea1 into gh-pr/363/base 2026-11-26 04:00:58 +00:00
Author
Owner

@⁠SkippySteve on GitHub · 2026-11-24 03:06 UTC · original

Thanks for this. The bug is real: on main, VICTORY_CONFIG= is turned into PathBuf::from(""), and startup stops with VICTORY_CONFIG points at , which does not exist. The fix is right too.

What I checked

  • On the PR head (4874c3f), Linux, cargo test -p victory-core config: 5 passed, including the new empty_config_env_is_ignored.
  • The new helper takes an env closure, the same way resolve does, 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_config does the same .filter(|v| !v.is_empty()) on VICTORY_CONFIG, and the module docs now say "a variable that is set but empty counts as unset". Its test victory_config_expands_tilde_and_ignores_empty covers 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 in crates/victory-core/src/config.rs. I checked this with a trial merge.

Suggestion

  • If #241 lands first, this PR isn't needed any more and can be closed.
  • If maintainers would like this small fix in sooner, it's fine to merge on its own. #241 will then rebase onto it and drop its copy of the filter.

Either way, nothing needs to change in this PR.

**@⁠SkippySteve** on GitHub · 2026-11-24 03:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/363#issuecomment-7120781686) Thanks for this. The bug is real: on `main`, `VICTORY_CONFIG=` is turned into `PathBuf::from("")`, and startup stops with `VICTORY_CONFIG points at , which does not exist`. The fix is right too. **What I checked** - On the PR head (`4874c3f`), Linux, `cargo test -p victory-core config`: 5 passed, including the new `empty_config_env_is_ignored`. - The new helper takes an env closure, the same way `resolve` does, 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_config` does the same `.filter(|v| !v.is_empty())` on `VICTORY_CONFIG`, and the module docs now say "a variable that is set but empty counts as unset". Its test `victory_config_expands_tilde_and_ignores_empty` covers 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 in `crates/victory-core/src/config.rs`. I checked this with a trial merge. **Suggestion** - If #241 lands first, this PR isn't needed any more and can be closed. - If maintainers would like this small fix in sooner, it's fine to merge on its own. #241 will then rebase onto it and drop its copy of the filter. Either way, nothing needs to change in this PR.
Author
Owner

@⁠enzoduarte1 on GitHub · 2026-11-24 03:34 UTC · original

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.

**@⁠enzoduarte1** on GitHub · 2026-11-24 03:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/363#issuecomment-7121230672) 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.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!363
No description provided.