Skip to main content

Module xdg

Module xdg 

Source
Expand description

Single source of truth for the linesmith XDG cascade.

All linesmith paths derived from $XDG_*_HOME / $HOME flow through resolve_subdir. Three runtime callers used to re-implement the same cascade independently (cache root, segment plugin dir, user theme dir), with the doctor mirroring all three — every consumer was a drift opportunity. Collapsing them here gives one cascade definition + one piece of test surface.

The function is pure: it takes XdgEnv (a snapshot of the relevant env vars) and a XdgScope tag, returns a PathBuf or None. Callers build XdgEnv at the boundary — driver.rs from CliEnv, doctor from its [crate::doctor::EnvVarState] snapshot — so the cascade itself never touches std::env.

Structs§

XdgEnv
Snapshot of the env vars the XDG cascade reads. Only xdg and home matter; the cascade has no other inputs.

Enums§

XdgScope
Which XDG base spec directory the caller wants.

Functions§

resolve_subdir
Resolve $XDG_<scope>_HOME/linesmith/<sub> falling back to $HOME/.<cache|config>/linesmith/<sub>. None when neither source is populated.