Core: ignore empty LOCALAPPDATA, XDG_CACHE_HOME, and HOME in default directory resolution #2579
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2579
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2579"
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?
@reeledMarek on GitHub · 2026-11-25 16:08 UTC · original
reeledMarek:fix/core-config-default-dir-empty-env→main· +34 −4 · 1 files · 1 commits · openSummary
In
victory-core/src/config.rs, empty environment variables (LOCALAPPDATA="",XDG_CACHE_HOME="",HOME="") were treated as valid base paths, causing default cache/config directories to resolve to relative paths under the current working directory instead of falling back properly.Now empty values are ignored during default directory resolution.
Testing
cargo test -p victory-core --locked(14/14 passed, including synthetic tests for empty env values)cargo clippy -p victory-core --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings(clean)cargo test -p xtask --locked(6/6 passed)@Marvisak on GitHub · 2026-11-25 22:18 UTC · original
Automated triage for the maintainers.
Merge candidate (small). In
victory-core/src/config.rs,default_dirtook an emptyLOCALAPPDATA,XDG_CACHE_HOMEorHOMEas a base. That gave a relativevictory/<name>under the current folder. Now empty values fall through to the next variable, and then to the existing "set VICTORY_CACHE_DIR and VICTORY_DATA_DIR" error. This matches how the same file already treats emptyVICTORY_GAME_DIR/VICTORY_CONFIG(see its existing tests). Thedefault_dir_fromsplit with an injectedenvfollows the file's pattern, and the test covers both the fallback and the error.CI:
checkpassing. Merges cleanly into currentmain. A recommendation to look at it, not an approval.Generated by Claude Code
@lcg007xd-c on GitHub · 2026-11-25 21:21 UTC · original · approved these changes
Verified on Linux (Rust 1.99.0)
Branch: current
main(13f91ca) + this PR (merges cleanly; it also merges cleanly with #2578).cargo test --locked -p victory-core: 14 passed..filter(|v| !v.is_empty())indefault_dir_fromremoved (refactor kept),default_dir_ignores_empty_user_env_varsfails. So the test pins the fix.cargo clippy --locked --target x86_64-pc-windows-msvc -p victory-core --all-targets -- -D warnings: clean, same as main.Review
The fix is correct, and it makes
default_dirconsistent withresolve's ownenv_path, which already drops empty values (config.rs:85). No defect found.Prior art: the same fix was in #243 ("Config: skip an empty or relative cache base for the default directories"), which was folded into #241. #241 was then closed unmerged yesterday after a needs-rebase triage. So nothing on main covers this, and this PR is the live version. Two small follow-ups, either here or later:
XDG_CACHE_HOME=foostill yieldsfoo/victory/cacheunder the working directory here, which is usually the checkout, andsubdirthen fails with the asset-policy error. Adding.filter(|p| p.is_absolute())togetwould cover it.resolve.Config::resolvetakes an injectableenv, but its fallback still callsdefault_dir, which reads the real process environment (config.rs:93-97). Passingresolve'senvthrough todefault_dir_fromwould make the existingresolvetests independent of the host'sLOCALAPPDATA/HOME.Not verified
LOCALAPPDATA. Only the logic is covered, through the injected env.Reviewed with Claude Code.
@Will-0f-D on GitHub · 2026-11-26 16:14 UTC · original
Independent native Windows verification of this PR at
61349a7fcf3d651aa812cf8b8c7369f68f7011ed, with main63bcca43c6a00a758510398fa43096ce7e4f7df0as the negative control.Environment: Windows 11 Pro x64 (
10.0.26300), Rust1.98.1,x86_64-pc-windows-msvc.I built the same standalone probe against each checkout. Each case invokes
the public
Config::load()API in a separate child process, removing therelevant environment variables first and using a working directory with no
victory.toml. This tests the real environment path rather than callingthe injected helper directly. Both
cache_diranddata_dirare checked.cargo test -p victory-core --lockedcargo clippy -p victory-core --all-targets --locked -- -D warningscargo test -p xtask --lockedThe five negative-control failures are:
Main returns relative paths for these cases; this PR produces the expected
fallbacks or error. The passing controls cover all bases absent, normal
LOCALAPPDATA/XDG/HOME precedence, HOME's
.cachecomponent, and explicitVICTORY_CACHE_DIR/VICTORY_DATA_DIR overrides when the bases are empty.
No game files, GPU or gameplay used. No production code changes or duplicate
fix: credit for the implementation remains with the PR author.
AI-assisted verification and probe authoring with OpenAI Codex. This is a
focused verification report, not a full-workspace test or formal approval.
@fuzeofficlal on GitHub · 2026-11-26 17:39 UTC · original · approved these changes
Looks good. Verified merged onto
main(63bcca43) on Windows 11:default_dir_from(crates/victory-core/src/config.rs:147-159) cleanly filters empty values via.filter(|v| !v.is_empty()), matching the existingenv_pathandexplicit_config_pathconventions inconfig.rsand preserving non-UTF-8OsStringpaths.cargo xtask policy(191 files ok),cargo clippy --locked -p victory-core --all-targets -- -D warnings(default and--all-features), andcargo test --locked -p victory-core(14/14, includingdefault_dir_ignores_empty_user_env_vars) all pass.(LOCALAPPDATA, XDG_CACHE_HOME, HOME)x{unset, "", valid}matrix, a Windows unpaired-surrogateOsStringpath check, and 3 real Windows 11 child-processConfig::load()checks confirming emptyLOCALAPPDATAfalls through toXDG_CACHE_HOME, thenHOME/.cache, and returnsErrwhen all three are empty.(Non-blocking note:
Config::resolvestill callsdefault_dirdirectly rather than threading itsenvclosure intodefault_dir_from, which is fine as-is and can be left for a separate cleanup if ever needed.)View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.