Core host UX: XDG data dir, config-relative paths, and clearer VICTORY_LOG handling #241
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!241
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/241/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:43 UTC · original
SkippySteve/core-xdg-data-dir→main· +7850 −72 · 5 files · 97 commits · closed without mergingHost-side UX fixes in
victory-corefor where Victory keeps files and how it reports its settings. This PR now also includes #243, which changed the same function, #277, which makesvictory configshow the data folder, and #266, which warns whenVICTORY_LOG/RUST_LOGdoes not parse. #243, #277 and #266 are closed in its favour.Problem
Config::data_diris documented as "never inside the cache, which may be deleted at any time". WithoutLOCALAPPDATA(a native non-Windows host, e.g. the Linux crates/tools),default_dirused the cache base for both, so the default data dir was$XDG_CACHE_HOME/victory/data(~/.cache/victory/data). Clearing~/.cache, as desktop cleaners and users routinely do, would delete what titles saved.XDG_CACHE_HOME=, common in shells and wrapper scripts) or relative still won. The base then became relative to the working directory, usually the repo checkout, andcache_subdirfailed with the asset-policy error instead of using~/.cache.Change (
crates/victory-core/src/config.rsonly)LOCALAPPDATA: unchanged (…\victory\cache,…\victory\data).$XDG_CACHE_HOME/victory(else~/.cache/victory), data →$XDG_DATA_HOME/victory(else~/.local/share/victory).LOCALAPPDATA/XDG_CACHE_HOME/XDG_DATA_HOME/HOMEvalues are skipped and the next candidate is tried, as the XDG spec asks. 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, so the defaults can be unit-tested.load()still passes the real environment.VICTORY_CACHE_DIR/VICTORY_DATA_DIRandvictory.tomlstill take precedence.Tests (hermetic: none read the host's real
HOME/XDG_*/LOCALAPPDATA, and they useC:\…paths on Windows so they stay absolute)local_app_data_holds_cache_and_data,data_is_not_under_the_xdg_cache,empty_or_relative_values_are_ignored,default_dir_prefers_localappdata_then_xdg_then_home,no_user_directory_is_an_error.resolvetests now getHOMEthrough the closure. Before, they failed underenv -u HOME.Validated on Linux (config part):
cargo test -p victory-corepasses, and also passes withHOME,XDG_CACHE_HOMEandXDG_DATA_HOMEunset.cargo clippy -p victory-core --all-targets -- -D warningsis clean for the host and forx86_64-pc-windows-msvc.config.rspasses rustfmt, andcargo xtask policyis ok. I haven't run it on Windows. No game data was used.victory configshows the data folder (was #277,apps/victory/src/main.rs)The data folder (saves, settings, crashes.log) is resolved by
Configlike the cache folder, butvictory configneither printed it nor ran the outside-the-repository check on it, so aVICTORY_DATA_DIRor[paths].data_dirpointing into the source tree went unreported. It now printsdata_dirand checks it withensure_outside_repoalongsidecache_dir. Two lines;apps/victorydoes not yet build on Linux (#235), so this part is checked by review only.Warn when
VICTORY_LOG/RUST_LOGdoes not parse (was #266,crates/victory-core/src/logging.rs)A filter that tracing-subscriber rejects, for example
VICTORY_LOG=victory_loader=loud, was dropped silently and the binary logged at its default level, so a typo looked like the target had nothing to log.logging::initnow prints one line on stderr naming the variable, its value and the parse error, then falls back to the default level as before:Picking the filter moves into
choose_filter, so it can be tested without changing the process environment. Precedence is unchanged (VICTORY_LOG, thenRUST_LOG, then the default). Five new tests: unset,VICTORY_LOGoverRUST_LOG, theRUST_LOGfallback, and a bad value in each variable.Config file paths and empty variables (
config.rs,victory.example.toml)game_dir,cache_dir,data_dir,test_titles) are now relative to the file. Before, withVICTORY_CONFIGpointing at another folder,cache_dir = "cache"landed under the working directory, which is often the repository, so the asset policy refused it../victory.tomlbehaves as before.VICTORY_CONFIGcounts as unset instead of failing with "points at , which does not exist". An emptyVICTORY_TEST_TITLESno longer replaces the file's list with nothing. The otherVICTORY_*variables already ignored empty values.victory.example.tomlsays this and gives the rightVICTORY_TEST_TITLESseparator (;on Windows,:elsewhere).relative_file_paths_are_relative_to_the_file,the_default_config_file_keeps_paths_as_written,empty_test_titles_variable_falls_back_to_the_file.Logging: empty filters and the
diagnosticscap (logging.rs)VICTORY_LOG/RUST_LOGcounts as unset. Before,VICTORY_LOG=made an empty filter that hid everything but errors and also hidRUST_LOG.diagnosticsfeature was capped at info without saying so. It now prints one line on stderr:victory: the log filter asks for trace output, but this build logs info and above; rebuild with --features diagnostics for debug and trace.empty_values_count_as_unset,a_filter_above_the_cap_is_reported.~in configured paths (config.rs,victory.example.toml)~. Sogame_dir = "~/Games/gta"invictory.tomlnamed a folder literally called~next to the file, andVICTORY_GAME_DIR="~/Games/gta"named one under the working directory. That's an easy mistake on Linux/Proton setups.~component in[paths]values and inVICTORY_GAME_DIR/VICTORY_CACHE_DIR/VICTORY_DATA_DIR/VICTORY_TEST_TITLESnow means the home directory:HOME, elseUSERPROFILE, if it is absolute.~user/…and a~that is not the first component are left as written. A leading~with no usable home directory is refused (see below).a_leading_tilde_is_the_home_directory,tilde_in_the_file_is_home_not_next_to_the_file,tilde_in_variables_is_home,home_dir_falls_back_to_userprofile_and_skips_relative.VICTORY_CONFIGas a folder, non-UTF-8 log variables, Linux defaults (config.rs,logging.rs,victory.example.toml)VICTORY_CONFIGpointing at the folder that holdsvictory.tomlwas reported as "which does not exist". It now says… which is a folder, not a config file; did you mean <folder>/victory.toml?(the hint only when that file is there). The file lookup moves intoconfig_fileso it can be tested.VICTORY_LOG/RUST_LOGvalue that is not valid UTF-8 was dropped silently bystd::env::var(..).ok(). It is now reported on stderr (victory: ignoring RUST_LOG="w\xFF": it is not valid UTF-8) and treated as unset.victory.example.tomlgave only the%LOCALAPPDATA%defaults. It now also gives the Linux ones ($XDG_CACHE_HOME/victoryor~/.cache/victory,$XDG_DATA_HOME/victoryor~/.local/share/victory) and saysVICTORY_CONFIGnames the file, not its folder.victory_config_must_name_a_file(uses a folder under the system temp dir),a_non_utf8_variable_is_reported_and_unset.The data folder must not be inside the cache (
config.rs,victory.example.toml)data_diris documented as never inside the cache, but explicit settings could still put it there, e.g.VICTORY_CACHE_DIR=~/victorywithVICTORY_DATA_DIR=~/victory/data, orVICTORY_CACHE_DIR=~with the default~/.local/share/victory. Clearing the cache would then delete saves.Config::resolvenow fails withthe data folder … is inside the cache folder …, which may be deleted at any time; set VICTORY_DATA_DIR or [paths].data_dir to a folder outside it. It compares the paths as written, so nothing has to exist yet. A sibling like/v-datanext to/vis allowed, and so is the cache inside the data folder.data_inside_the_cache_is_refused.tilde_in_variables_is_homenow sets the cache to~/cache, because a cache of~would hold the default data folder.~inVICTORY_CONFIG(config.rs,victory.example.toml)~, butVICTORY_CONFIGdid not, so a quotedVICTORY_CONFIG="~/victory.toml"failed withVICTORY_CONFIG points at ~/victory.toml, which does not exist. It now goes through the sameexpand_home(via a smallexplicit_confighelper, so it can be tested without touching the real environment); empty still counts as unset.load()resolves the home directory once and reuses it.victory_config_expands_tilde_and_ignores_empty. This also covers what open #363 asks for (emptyVICTORY_CONFIG), which this PR already did.Validated (whole PR) on Linux:
cargo test -p victory-corepasses (33 tests), also withHOME/XDG_CACHE_HOME/XDG_DATA_HOMEunset and with--features diagnostics.cargo clippy -p victory-core --all-targets -- -D warningsis clean with and without--features diagnostics, and forx86_64-pc-windows-msvc.cargo fmt -p victory-core --checkis clean andcargo xtask policyis ok.Say where each setting came from (
config.rs,apps/victory/src/main.rs)Confignow hasorigins(Origin::Env("VICTORY_CACHE_DIR"),Origin::FileorOrigin::Default) forgame_dir,cache_dir,data_dirandtest_titles. Empty variables still count as unset and are never the origin.victory configprints it next to each value, e.g.cache_dir : /home/me/.cache/victory [default].the data folder … (from default) is inside the cache folder … (from config file) ….origins_name_the_setting_that_won,data_inside_the_cache_names_both_origins. With them,cargo test -p victory-corepasses 33 tests (also withHOME/XDG_*unset and with--features diagnostics). clippy-D warningsis clean for the host, withdiagnostics, and forx86_64-pc-windows-msvc. fmt is clean andcargo xtask policyis ok. As before, themain.rslines are checked by review only (#235).Refuse a Windows drive path on a non-Windows host (
config.rs,victory.example.toml)victory.example.tomlshipsgame_dir = 'D:\victory-data\game'. On Linux that is not absolute, so a copy used unedited was anchored under the config file's folder (usually the repository) and only showed up later as a policy violation or a folder that does not exist.[paths]values andVICTORY_GAME_DIR/VICTORY_CACHE_DIR/VICTORY_DATA_DIR/VICTORY_TEST_TITLESare now checked before use. On a non-Windows host,X:,X:\…orX:/…fails with[paths].game_dir is D:\victory-data\game, a Windows path, but this host is not Windows; set it to a path on this machine(in<file>).VICTORY_TEST_TITLESis checked before it is split, because:would cutD:\ain two. Windows is unchanged. The example file now says its paths are Windows examples.windows_drive_paths_are_refused_off_windows. On Linuxcargo test -p victory-corepasses 34 tests, also withHOME/XDG_*unset and with--features diagnostics. clippy-D warningsis clean for the host, withdiagnostics, and forx86_64-pc-windows-msvc. fmt is clean andcargo xtask policyis ok.A
[paths]key at the top level of the config file (config.rs)game_dir = '/games/gta'with no[paths]header (an easy firstvictory.toml), or a key written above the header, failed with onlyunknown field \game_dir`, expected `paths`. It now saysgame_dir must be under the [paths] table: put a `[paths]` line above it (see victory.example.toml), naming every misplaced key. Other parse errors ([path],gamedir = ...`) keep toml's own message.top_level_path_keys_say_where_they_belong;example_config_parsesgoes through the same parser. On Linuxcargo test -p victory-corepasses 35 tests, also withHOME/XDG_*unset and with--features diagnostics. clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok..and..in the data/cache check (config.rs)VICTORY_DATA_DIR=~/.cache/victory/../data(a sibling of the cache) was refused, and a cache of~/victory/tmp/..was not seen to hold~/victory/data. Both paths now have.and..folded lexically before the comparison (lexical). It still does not touch the disk or follow symlinks, and the error still shows the paths as written.data_inside_the_cache_ignores_dot_dot,lexical_folds_dot_and_dot_dot. On Linuxcargo test -p victory-corepasses 37 tests, also withHOME/XDG_*unset and with--features diagnostics(run withTMPDIRoutside the repository, whichpolicy::tests::accepts_unrelated_directoriesneeds). clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok.Keep the game folder apart from the cache and data folders (
config.rs,victory.example.toml)VICTORY_CACHE_DIR=~/gtawithVICTORY_GAME_DIR=~/gta/game), where clearing the cache would delete the dump, or the cache/data folder from being inside it (avictory.tomlkept in the dump withcache_dir = "cache"), which writes derived files and saves into the dump.Config::resolvenow refuses both when a game folder is set, e.g.the cache folder … (from config file) is inside the game folder … (from config file), which holds your dump and is only read; set VICTORY_CACHE_DIR or [paths].cache_dir to a folder outside it. Compared like the data-inside-cache check: lexically,./..folded, no disk access. Siblings (/vand/v-cache) are fine. The example file says so.game_folder_is_kept_apart_from_cache_and_data,a_config_file_inside_the_dump_cannot_put_the_cache_there(synthetic paths only). On Linuxcargo test -p victory-corepasses 39 tests, also withHOME/XDG_*unset and with--features diagnostics(TMPDIRoutside the repository). clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok.Control characters in a path setting (
config.rs).envfile with Windows line endings (set -a; . ./victory.env, a container env file, a Proton/Wine wrapper script) ends in an invisible\r.VICTORY_GAME_DIR=/games/gta\rwas then reported later only as "does not exist", which looks right on screen.VICTORY_GAME_DIR/VICTORY_CACHE_DIR/VICTORY_DATA_DIR/VICTORY_TEST_TITLES,VICTORY_CONFIGand the[paths]values) is now checked before use. One holding a control character fails withVICTORY_GAME_DIR is "/games/gta\r", which contains the control character '\r' (a Windows line ending: was it read from a file saved with CRLF line endings?); remove it. The value is quoted so the character shows. Spaces and non-ASCII names are unaffected.control_characters_in_paths_are_refused(synthetic paths only). On Linuxcargo test -p victory-corepasses 43 tests, also withHOME/XDG_*unset and with--features diagnostics(TMPDIRoutside the repository). clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok.Quoted path settings (
config.rs)docker run --env-file, systemdEnvironmentFile=, IDE run configurations and Windowsset VICTORY_GAME_DIR="D:\games"keep them, soVICTORY_GAME_DIR="/games/gta"arrived as"/games/gta"with the quotes. That is not absolute, so it was taken as a folder named"under the working directory (often the repository) and reported later only as "does not exist" or "inside the repository".VICTORY_CONFIG, the[paths]values) that starts and ends with the same"or'now fails withVICTORY_GAME_DIR is "/games/gta", quotes included; the quotes are not removed when the value comes from an env file or a launcher rather than a shell, so remove them. A quote elsewhere in a name (/games/Rockstar's) is unaffected.quoted_paths_are_refused(synthetic paths only). On Linuxcargo test -p victory-corepasses 44 tests, also withHOME/XDG_*unset and with--features diagnostics(TMPDIRoutside the repository). clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok.Whitespace around a path setting (
config.rs)VICTORY_GAME_DIR= /games/gtaarrived with a leading space. That is not absolute, so it was taken as a folder namedunder the config file's folder or the working directory (often the repository). A trailing space (or a no-break space pasted from a web page) was reported later only as "does not exist", which looks right on screen.VICTORY_GAME_DIR is " /games/gta", which starts with whitespace; remove it.VICTORY_TEST_TITLESis also checked entry by entry, so/a: /bis caught. Spaces inside a name (/Program Files/x) are unaffected.surrounding_whitespace_in_paths_is_refused(synthetic paths only). On Linuxcargo test -p victory-corepasses 45 tests, clippy-D warningsis clean for victory-core and fmt is clean.Unexpanded variables in a path setting (
config.rs,victory.example.toml)$HOME(and onlycmdexpands%LOCALAPPDATA%). TOML,docker run --env-file, systemdEnvironmentFile=and launcher or IDE run configurations keep them as written. Sogame_dir = "$HOME/Games/gta", ordata_dir = '%LOCALAPPDATA%\victory\data'copied from the defaults the example file lists, was relative. It was taken as a folder named$HOMEunder the config file's folder or the working directory (often the repository).VICTORY_CONFIG, the[paths]values) that names a variable now fails withVICTORY_GAME_DIR is $HOME/Games/gta, which names the variable $HOME; variables are not expanded in the config file or when the value comes from an env file or a launcher rather than a shell, so write the path out in full (a leading ~ is the home directory). It recognises a whole$NAMEcomponent,${NAME}and%NAME%(including%ProgramFiles(x86)%). Real names such as$Recycle.Bin,share$,$HOME.oldand100%are unaffected. The example file now says variables are not expanded.unexpanded_variables_in_paths_are_refused(synthetic paths only). On Linuxcargo test -p victory-corepasses 46 tests, also withHOME/XDG_*unset and with--features diagnostics(TMPDIRoutside the repository). clippy-D warningsis clean for the host, withdiagnostics, and forx86_64-pc-windows-msvc. fmt is clean andcargo xtask policyis ok.Empty values in the config file (
config.rs,victory.example.toml)game_dir = ''(a blank a template leaves to fill in) was anchored at the config file's folder, often the repository, and with./victory.tomlit became the empty path, which is the working directory.test_titles = ['']did the same for one entry.game_dir,cache_dir,data_dirandtest_titlesentries in[paths]now count as unset, so the defaults apply andvictory configreports[default], not[config file]. The example file says so.empty_file_values_count_as_unset(synthetic paths only). On Linuxcargo test -p victory-corepasses 47 tests, also withHOME/XDG_*unset and with--features diagnostics(TMPDIRand the build folder outside the repository). clippy-D warningsis clean for the host and forx86_64-pc-windows-msvc. fmt is clean andcargo xtask policyis ok.A folder setting that names a file (
config.rs)VICTORY_GAME_DIR=~/games/gta/default.xex(the executable picked in a file dialog or pasted from a launcher's target, rather than its folder) was accepted and only failed later, per file, with "Not a directory". A cache or data folder that names an existing file failed on first use with "File exists", naming neither the setting nor the fix.the game folder /games/gta/default.xex (from VICTORY_GAME_DIR) is a file, not a folder; set VICTORY_GAME_DIR or [paths].game_dir to the folder holding the dump, perhaps /games/gta. A path that does not exist yet is still fine.a_folder_setting_naming_a_file_is_refused(an empty scratch file under the system temp folder, removed afterwards; no game data). On Linuxcargo test -p victory-corepasses 48 tests, also withHOME/XDG_*unset and with--features diagnostics(TMPDIRand the build folder outside the repository). clippy-D warningsis clean for the host and forx86_64-pc-windows-msvc. fmt is clean andcargo xtask policyis ok.A leading
~with no home directory (config.rs)HOMEandUSERPROFILEunset or relative (env -i, a bare systemd unit, some containers), a leading~was kept as written.VICTORY_CACHE_DIR=~/cachethen named a folder literally called~under the working directory (often the repository), and[paths].game_dir = '~/gta'one next to the config file. Such a folder is created on first use and easy to delete by mistake withrm -rf ~.~in any path setting (the four variables,VICTORY_CONFIG, the[paths]values) now fails at load when there is no home directory:VICTORY_CACHE_DIR is ~/cache, but there is no home directory to put in place of~(HOME is unset or not absolute); set HOME or write the full path.~user/…, a non-leading~, and paths without~are unaffected.a_leading_tilde_without_a_home_is_refused(synthetic paths only);a_leading_tilde_is_the_home_directoryandvictory_config_expands_tilde_and_ignores_emptyupdated. On Linuxcargo test -p victory-corepasses 49 tests, also withHOME/XDG_*unset (TMPDIRand the build folder outside the repository). clippy-D warningsis clean for the host and forx86_64-pc-windows-msvc. fmt is clean andcargo xtask policyis ok.A
file://URI instead of a path (config.rs).desktopfile or a launcher's config, givesfile:///home/me/Games/My%20Games/gta. Nothing decoded it: the value is relative, so it was taken as a folder namedfile:under the config file's folder or the working directory (often the repository), with%20kept as three characters.VICTORY_CONFIG, the[paths]values) that starts withfile:(any case) now fails at load:VICTORY_GAME_DIR is file:///games/My%20Games/gta, a file: URI rather than a path; write the path instead, perhaps /games/My Games/gta. The suggestion decodes%XX, accepts an empty orlocalhosthost and turns/C:/gamesintoC:/games; for another host (a network share) or a bad escape it is left out./files,filedandfileare unaffected.file_uris_are_refused(synthetic paths only). On Linuxcargo test -p victory-corepasses 50 tests, also withHOME/XDG_*unset (TMPDIRand the build folder outside the repository). clippy-D warningsis clean for the host and forx86_64-pc-windows-msvc. fmt is clean andcargo xtask policyis ok.Relative path settings (
config.rs)VICTORY_DATA_DIR=data(or a relative value in./victory.toml, whose folder is the empty path) was kept relative. The data-inside-cache and game-folder checks compare paths as written, soVICTORY_CACHE_DIR=/home/me/victorywithVICTORY_DATA_DIR=data, started from/home/me/victory, put saves inside the cache unnoticed, andvictory configshoweddatarather than the folder used.Config::loadnow joins any path still relative after resolution to the working directory before the checks, so they see the real folder andvictory configshows it. Paths in aVICTORY_CONFIGfile elsewhere are still relative to that file.relative_paths_are_joined_to_the_working_directory(synthetic paths only). On Linuxcargo test -p victory-corepasses 54 tests, also withHOME/XDG_*unset (TMPDIRand the build folder outside the repository). clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok.Cache or data folder at the drive root or the home folder (
config.rs)VICTORY_CACHE_DIR=$HOME/$APPwithAPPunset is~/, andVICTORY_DATA_DIR=$XDG_DATA_HOME/withXDG_DATA_HOMEunset is/. Both were accepted. The cache may be deleted at any time, so clearing a cache of~would delete the home folder, and a data folder of~puts saves, settings and crashes.log loose in it./home) now fails at load:the cache folder /home/me (from VICTORY_CACHE_DIR) is your home folder; set VICTORY_CACHE_DIR or [paths].cache_dir to a folder used only by Victory, or leave it unset for the default. It is compared lexically like the other folder checks (~/games/..counts as home), and folders inside home, siblings of it and/home/me2are unaffected. The defaults never hit it.cache_or_data_at_the_root_or_home_is_refused(synthetic paths only).data_inside_the_cache_names_both_originsused the home folder as its cache, so it now uses another folder. On Linuxcargo test -p victory-corepasses 55 tests, also withHOME/XDG_*unset (TMPDIRand the build folder outside the repository). clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok.A misspelled path variable (
config.rs)VICTORY_GAMEDIR=/games/gta,VICTORY_DATA_PATH=…or a lowercasevictory_cache_dirwas ignored without a word, and the default was used. Saves then went to~/.local/share/victory, not the folder the user named, and the game folder was reported as not set.Config::loadnow checks the names in the environment first. A near miss ofVICTORY_GAME_DIR/VICTORY_CACHE_DIR/VICTORY_DATA_DIR/VICTORY_TEST_TITLES/VICTORY_CONFIGfails while the real variable is unset or empty:VICTORY_GAMEDIR is set, but Victory reads VICTORY_GAME_DIR, which is not set; rename VICTORY_GAMEDIR to VICTORY_GAME_DIR. A near miss is one of these: the same letters ignoring case,_and-; a_DIRvariable with the suffix dropped or spelt_PATH/_DIRECTORY/_FOLDER;VICTORY_TEST_TITLEorVICTORY_TITLES; orVICTORY_CONFIG_FILE/_PATH. When the real variable is set, the near miss is left alone. OtherVICTORY_*variables (VICTORY_LOG,VICTORY_WARP, …) are unaffected.misspelled_variables_are_refused(synthetic names, no process environment). On Linuxcargo test -p victory-corepasses 58 tests, also withHOME/XDG_*unset (TMPDIRand the build folder outside the repository). clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok.VICTORY_TEST_TITLESjoined with the wrong separator (config.rs,victory.example.toml)VICTORY_TEST_TITLES=/t/one;/t/two(a list copied from a Windows.bat) or/t/one,/t/twoon Linux, orC:\t\one:D:\t\twoon Windows, was not split, so it became one title namedone;/t/twounder/t. Both titles were dropped without a word, and the run reported only that the path does not exist.;or,(:or,on Windows) is followed, after any spaces, by the start of another absolute path (/or~, or a drive path on Windows), loading fails:VICTORY_TEST_TITLES holds "/t/one;/t/two", which looks like several titles joined with ';'; on this host they are separated by ':'. A folder whose name just contains a;or,(/games/a,b) is not affected, and neither istest_titlesin the file, which is a TOML array.test_titles_joined_with_the_wrong_separator_are_refusedcovers both hosts through anon_windowsparameter, using synthetic paths only. On Linux,cargo test -p victory-corepasses 59 tests, also withHOME/XDG_*unset (TMPDIRand the build folder outside the repository). clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok.A Windows backslash path off Windows (
config.rs)VICTORY_GAME_DIR=\Games\gta,..\games\gtaor[paths].data_dir = '~\saves', copied from a Windows guide or a.batfile, has no drive letter, so the drive-path check let it through. Off Windows the backslashes are ordinary characters, so it became one relative folder named\Games\gtaunder the config file's folder or the working directory (often the repository), and~\saveswas reported as another user's home.VICTORY_CONFIG, the[paths]values) that starts with a single\, or with.\,..\or~\, now fails off Windows:VICTORY_GAME_DIR is \Games\gta, which uses Windows backslashes, but this host is not Windows; write it with/, perhaps /Games/gta. A backslash later in a name (games\gta,/games/a\b), UNC paths (already refused as network paths) and anything on Windows are unaffected.windows_backslash_paths_are_refused_off_windows(synthetic paths only);windows_network_paths_are_refused_off_windowsno longer lists\gamesas allowed. On Linuxcargo test -p victory-corepasses 60 tests, also withHOME/XDG_*unset (TMPDIRand the build folder outside the repository). clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok.Keep the test titles apart from the cache and data folders (
config.rs)VICTORY_TEST_TITLES/[paths].test_titlesentries, which are also dumps Victory only reads, were not. With one parent folder for everything (VICTORY_CACHE_DIR=~/xbox,VICTORY_TEST_TITLES=~/xbox/title-a), clearing the cache would delete a title, and a cache or data folder inside a title would mix derived files and saves into that dump.the test title /x/title-a (from VICTORY_TEST_TITLES) is inside the cache folder /x (from VICTORY_CACHE_DIR), which may be deleted at any time; ..., andthe data folder ... is inside the test title .... Compared lexically like the other folder checks (./..folded, case folded on Windows/macOS); siblings such as/x-cacheare fine.test_titles_are_kept_apart_from_cache_and_data(synthetic paths only). On Linuxcargo test -p victory-corepasses 61 tests, also withHOME/XDG_*unset (TMPDIRand the build folder outside the repository). clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok.A test title that names a file (
config.rs)VICTORY_GAME_DIR=~/games/gta/default.xex), butVICTORY_TEST_TITLES/[paths].test_titlesentries, which are dumps too, were not: picking the executable instead of its folder was accepted and only failed later, per file, with "Not a directory".the test title /x/title-a/default.xex (from VICTORY_TEST_TITLES) is a file, not a folder; set VICTORY_TEST_TITLES or [paths].test_titles to the folder holding the dump, perhaps /x/title-a. A title that does not exist yet is still accepted.a_folder_setting_naming_a_file_is_refusednow covers a title from the variable and from the file (empty scratch file underTMPDIR, removed afterwards). On Linuxcargo test -p victory-corepasses 61 tests, also withHOME/XDG_*unset and with--features diagnostics. clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok.A test title listed twice, or the game folder in the list (
config.rs)victory census,translateandshadertake the game folder followed by the test titles when given no paths, so a title listed twice (VICTORY_TEST_TITLES=/x/a:/x/b:/x/a, or the same folder written as/x/aand/x/b/../a, orC:\Xbox\Aandc:\xbox\aon Windows) or the game folder pasted intotest_titleswas scanned and translated twice, doubling the time and the report.the test title /x/a (from VICTORY_TEST_TITLES) is listed twice (also as /x/a); remove one from VICTORY_TEST_TITLES or [paths].test_titles, andthe test title /x/a (from config file) is the game folder /x/a (from VICTORY_GAME_DIR); .... Compared lexically like the other folder checks (case folded on Windows/macOS only). A title nested inside another title or inside the game folder is a different folder and is still accepted.test_titles_must_be_distinct_and_not_the_game_folder(synthetic paths only);a_folder_setting_naming_a_file_is_refusedno longer lists the game folder as a title. On Linuxcargo test -p victory-corepasses 62 tests, also withHOME/XDG_*unset (TMPDIRand the build folder outside the repository). clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok.A data folder inside the user's cache (
config.rs)VICTORY_DATA_DIR=~/.cache/victory-saves, orXDG_DATA_HOMEset underXDG_CACHE_HOME(~/.cache/share, which moves the default data folder there while the cache folder is a sibling), was accepted, and clearing~/.cache(the problem this PR started from) deleted the saves.the data folder /home/me/.cache/saves (from VICTORY_DATA_DIR) is inside your cache folder /home/me/.cache (~/.cache), which may be deleted at any time; set VICTORY_DATA_DIR or [paths].data_dir to a folder outside it, such as one under ~/.local/share, with a variant namingXDG_DATA_HOMEwhen both are defaults. The cache base is$XDG_CACHE_HOME(absolute), else$HOME/.cache; the check is skipped when that base is the home folder or holds it. Compared lexically like the other folder checks.data_inside_the_user_cache_is_refused(synthetic paths only). On Linuxcargo test -p victory-corepasses 63 tests, also withHOME/XDG_*unset. clippy-D warningsis clean for the host andx86_64-pc-windows-msvc, fmt is clean andcargo xtask policyis ok.A trailing slash or
/.no longer hides a file or a dead link in a folder settinglstat("link/")follows the link, andPath::ancestorsgoes fromdefault.xex/straight to its parent. SoVICTORY_GAME_DIR=…/default.xex/, or a cache, data or test-title setting naming a dangling or looping link with a trailing/or/., was accepted as a folder still to create. It then failed later with "Not a directory" or "File exists". The folder check now walks the path with trailing separators and interior.dropped (..is kept), and the setting is still stored as written. Test:a_trailing_slash_or_dot_does_not_hide_a_file_or_a_link_that_leads_nowhere(Unix, scratch folder under the temp dir). I confirmed it fails without the fix.Supersedes #243, #277 and #266.
AI-assisted (Claude Code).
victory configshows the data folder and checks it is outside the repo 9a2b323b67lstat("link/") follows the link, and Path::ancestors goes from "default.xex/" straight to its parent, so VICTORY_GAME_DIR=.../default.xex/ or VICTORY_CACHE_DIR=<dangling link>/ passed as a folder still to create and failed later with "Not a directory" or "File exists". Walk the path with trailing separators and interior . dropped...from where it leads, as the OS does, so a gone end is named, never a decoy beside the link 7c1de54de8/.says to drop it from the link, naming the hops and the file, rather than "Not a directory" 76c2f8b12fmid/,mid/.) is followed past it, so a gone end is named rather than the slashed link that is present 8c9016d8bf@SkippySteve on GitHub · 2026-11-24 01:48 UTC · original
I've merged #243 (skip empty or relative LOCALAPPDATA/XDG/HOME values, hermetic tests) into this branch, since both PRs changed the same function. I've closed #243 so only one PR changes
config.rs.cargo test -p victory-corepasses (13 tests) and clippy is clean with-D warnings(host and Windows MSVC).victory configshows the data folder and checks it is outside the repo #277@MichaelSmithAI on GitHub · 2026-11-24 11:15 UTC · original
One upgrade detail for native Linux users: with a marker in the former default
~/.cache/victory/data, the CLI selects the new XDG data directory and leaves the marker behind. PointingVICTORY_DATA_DIRback into the cache is rejected, as intended. An ordinary Wine prefix continued to use its existing AppData paths.A short migration note beside the new defaults would help people find existing saves: before clearing the cache, check the former data directory (
$XDG_CACHE_HOME/victory/data, normally~/.cache/victory/data). If it contains data to keep, back it up, runvictory configto find the newdata_dir, and copy the contents there, preserving any newer files. The CLI check used synthetic data.@alexdeliu on GitHub · 2026-11-24 17:23 UTC · original
Merged onto
main@ffe310eb(PR heade8fbe936), this does not build on Windows: the tests incrates/victory-core/src/config.rs(around lines 7568-7612) usestd::os::unix::{fs::symlink, fs::FileTypeExt, net::UnixListener}without#[cfg(unix)], socargo clippy --all-targetsfails withE0433: cannot find unix in osandE0599: no method is_socket. Gating those tests on#[cfg(unix)]should be enough.Checked with CI's steps (both clippy runs with
-D warnings,cargo test --workspace) on Windows 11, AMD RX 9070. Every open PR: https://gist.github.com/alexdeliu/ef9ef0ebc1776ff104b5aa8eaea18e87@Marvisak on GitHub · 2026-11-25 00:23 UTC · original
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:apps/victory/src/main.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
Pull request closed