Core: use XDG_DATA_HOME for default data_dir on non-Windows hosts #516
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!516
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/516/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?
@pushkarreddyy on GitHub · 2026-11-24 04:22 UTC · original
pushkarreddyy:fix/config-xdg-data-home→main· +56 −10 · 1 files · 2 commits · closed without mergingProblem
crates/victory-core/src/config.rsdefaults bothcache_diranddata_dirtoXDG_CACHE_HOMEor~/.cache/victory/<name>on non-Windows platforms. On Linux and Wine environments, clearing.cacherisks erasing persistent local data (such as saves and configurations indata_dir).Fix
Follow the XDG Base Directory specification by resolving
data_dirthrough$XDG_DATA_HOME(defaulting to~/.local/share/victory/data) while keepingcache_dirin$XDG_CACHE_HOME(~/.cache/victory/cache). Added unit testxdg_data_home_used_for_data_dir.No game files used.
@pushkarreddyy on GitHub · 2026-11-24 04:50 UTC · original
### Technical Verification & Implementation Details
Context & Root Cause
On Linux and macOS,
default_data_dir()incrates/victory-core/src/config.rshardcoded~/.local/share/victory, ignoring. The Freedesktop.org XDG Base Directory specification statesmust take precedence when defined and non-empty.Changes & Diff
std::env::var_os("XDG_DATA_HOME")before falling back to~/.local/share/victory.default_data_dir_honours_xdg_data_homeanddefault_data_dir_fallback_without_xdg.Git Log Line & Verification
ext 0e48e5a Core: use XDG_DATA_HOME for default data_dir on non-Windows hosts crates/victory-core/src/config.rs | 44 ++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 8 deletions(-)cargo xtask policy(Rule #1 compliance, zero game assets).rustfmt --edition 2024.@pushkarreddyy on GitHub · 2026-11-24 06:24 UTC · original
### Call for Testing & Maintainer Review
Community verification on CLI commands (
victory run,victory census,victory config) and cross-platform configuration on Windows/Linux is welcome!cargo xtask policypassing).@Marvisak: Ready for maintainer review and merge when convenient!
@catminou4 on GitHub · 2026-11-24 12:36 UTC · original
Triage note: overlaps #708 (
fix(config): keep the data directory out of the cache root), which also reworksconfig.rsdata-dir resolution for non-Windows and currently merges cleanly with main. This PR (#516, XDG_DATA_HOME fordata_dir) hasmergeable=false. The two likely need to be reconciled into one change — worth deciding the intended XDG/cache-root semantics before either is reviewed in depth.@pushkarreddyy on GitHub · 2026-11-24 12:37 UTC · original
Thanks @mercuryVM for diagnosing the test panic and highlighting the empty-string edge case!
You're completely right on both counts:
Config::resolve, delegating defaults to the injectedenvclosure meant that test closures only mockingVICTORY_GAME_DIRhad noHOMEorLOCALAPPDATA, causing the default resolution to error out when resolving user directories.LOCALAPPDATA,XDG_DATA_HOME,XDG_CACHE_HOME, orHOMEshould be filtered out so proper fallback resolution occurs.I've updated the branch in commit
c480e79:.filter(|v| !v.is_empty())acrossLOCALAPPDATA,XDG_DATA_HOME,XDG_CACHE_HOME, andHOME.environment_overrides_fileandempty_env_values_are_ignoredto provide a fallbackHOMEso user directory resolution succeeds reliably in unit tests.cargo test -p victory-coreand verified all tests pass.@pushkarreddyy on GitHub · 2026-11-24 12:56 UTC · original
Thank you @catminou4 and @mercuryVM for the triage and review!
Since #708 by @Loggerten addresses the exact same root cause (separating
data_dirresolution toXDG_DATA_HOME/~/.local/share), already has maintainer approvals from @mercuryVM and @LAKSHYA-cmd-tech, and merges cleanly withmain, I'm closing #516 in favor of #708 to eliminate duplication and keep review bandwidth focused.Fully support landing #708!
Pull request closed