Config: skip an empty or relative cache base for the default directories #243
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!243
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/243/head"
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?
@SkippySteve on GitHub · 2026-11-24 01:45 UTC · original
SkippySteve/core-default-dir-env→main· +86 −9 · 1 files · 1 commits · closed without mergingWhen neither
VICTORY_CACHE_DIR/VICTORY_DATA_DIRnor the config file sets a path,Configfalls back toLOCALAPPDATA, thenXDG_CACHE_HOME, thenHOME/.cache. Today a variable that is set but empty (XDG_CACHE_HOME=, common in Linux shells and wrapper scripts) or relative wins anyway. The base then becomesvictory/cacherelative to the working directory, which is usually the repository checkout, andcache_subdirfails with the asset-policy error rather than using~/.cache.Change (
crates/victory-core/src/config.rs)default_dirskips empty and relative values, as the XDG base directory spec asks, and falls through to the next candidate. If none is usable you get the existing "set VICTORY_CACHE_DIR and VICTORY_DATA_DIR" error.default_dirnow reads through the sameenvclosure thatConfig::resolvealready takes. Production still passesstd::env::var_os, so behaviour with sane values is unchanged.Tests
resolvetaking its defaults from the given environment.resolvetests used to depend on the host's realLOCALAPPDATA/XDG_CACHE_HOME/HOME(they failed withenv -u HOME). They now supplyHOMEthrough the closure, so they are hermetic.Validated on Linux:
cargo test -p victory-core(11 passed, also withHOMEandXDG_CACHE_HOMEunset),cargo clippy -p victory-core --all-targets -D warningsfor both the host andx86_64-pc-windows-msvc,cargo fmt --check,cargo xtask policy. I haven't run the tests on Windows. The test helper usesC:\…paths there so they are absolute.@SkippySteve on GitHub · 2026-11-24 01:48 UTC · original
Superseded by #241 (combined). Both PRs changed
default_dirinconfig.rsand conflicted, so this change and its tests are now merged into #241.Pull request closed