core: resolve default data_dir via XDG_DATA_HOME on non-Windows hosts (fix on a fork) #899
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#899
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@DaniiL35 on GitHub · 2026-11-24 13:46 UTC · original
Pull requests are currently restricted to collaborators (#717), so I am sharing this bug report and verified fix from a clean fork branch off
main(ffe310e).• Branch: https://github.com/DaniiL35/VIctory/tree/fix/config-xdg-data-dir
• Commit:
5fcfd91(based onmainffe310e,crates/victory-core/src/config.rs+77/-9)• Compare: https://github.com/Marvisak/VIctory/compare/main...DaniiL35:VIctory:fix/config-xdg-data-dir
Problem
In
crates/victory-core/src/config.rs(line 20),data_diris documented:However,
default_dir(lines 130–137) resolved both"cache"and"data"using the exact same fallback chain:On Linux, macOS, and POSIX environments where
VICTORY_DATA_DIRis not explicitly set invictory.toml,data_dirdefaulted to$XDG_CACHE_HOME/victory/dataor$HOME/.cache/victory/data. A routine cache purge (e.g.rm -rf ~/.cache) would unintentionally delete the user's persistent saves, local storage, andcrashes.log.Furthermore,
default_dirread fromstd::env::var_osdirectly rather than theenvclosure passed intoConfig::resolve, preventing default directory resolution from being unit-tested in isolation without mutating process environment variables.Fix
default_dir_with(&env, name)."data", queryXDG_DATA_HOME(and fallback$HOME/.local/share) before falling back to cache locations:%LOCALAPPDATA%\victory\data(highest precedence).data_dirto$XDG_DATA_HOME/victory/dataor$HOME/.local/share/victory/data, keeping persistent data strictly outside the cache."cache", behavior is unchanged (LOCALAPPDATA->XDG_CACHE_HOME->$HOME/.cache).&envenables pure, deterministic unit testing of directory resolution.Tests Added
Added 3 synthetic unit tests in
crates/victory-core/src/config.rs:default_data_dir_uses_xdg_data_home_on_unix: verifiesdata_dirresolves to$XDG_DATA_HOME/victory/datawhilecache_dirresolves to$XDG_CACHE_HOME/victory/cache.default_data_dir_falls_back_to_local_share_with_home: verifies that when onlyHOMEis present,data_dirfalls back to$HOME/.local/share/victory/dataand not$HOME/.cache.localappdata_takes_precedence_for_both: verifies Windows%LOCALAPPDATA%takes precedence for both directories.Verification & Policy Compliance
cargo xtask policy(text-only, <512 KiB).main(ffe310e).AI-assisted with Antigravity.
@DaniiL35 on GitHub · 2026-11-24 16:17 UTC · original
PR opened directly: #1151
@Marvisak on GitHub · 2026-11-25 06:50 UTC · original
Automated triage for the maintainers.
Confirmed on current
main:default_dirincrates/victory-core/src/config.rsuses the sameLOCALAPPDATA→XDG_CACHE_HOME→$HOME/.cachechain for bothcacheanddata, so off Windows the persistent data directory defaults to a cache location, against thedata_dirdoc comment. On Windows (the supported host) it is%LOCALAPPDATA%\victory\dataand unaffected. PR #1151 was closed without merging and I found no other open PR; please open one again against currentmainif you want it considered. Whether non-Windows defaults matter is the maintainers' call.Generated by Claude Code