Config: skip an empty or relative cache base for the default directories #243
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/243"
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 SkippySteve on 2026-11-24T01:45:39Z.
When 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.Imported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T01:48:22Z.
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