Skip to main content

Module paths

Module paths 

Source
Expand description

Central resolution of every filesystem location TinyHarness touches.

Previously each module hard-coded its own ~/.config/tinyharness/... or ~/.local/share/tinyharness/... path by reading $HOME inline, which made the library impossible to drive against an alternate root (tests, embedded use, portable installs, a second profile). Every such location now lives in Paths, and every subsystem accepts a &Paths (or an explicit Path).

§Resolution rules

Logical locationDefault
config dir$XDG_CONFIG_HOME/tinyharness → $HOME/.config/tinyharness → .config/tinyharness
data dir$XDG_DATA_HOME/tinyharness → $HOME/.local/share/tinyharness → .local/share/tinyharness
project dirprocess CWD → .

The relative fallbacks preserve the pre-existing behaviour when HOME is unset (the old code did home.unwrap_or("."), yielding ./.config/...), so a caller with no home directory still gets a writable, self-consistent tree instead of a panic.

Per the XDG spec, XDG_*_HOME values that are empty or relative are ignored (a relative path is not an absolute path, so it cannot be resolved predictably against a project root); the $HOME fallback is used instead.

§Legacy locations

Personal skills historically lived in ~/.tinyharness/skills. That directory is still searched, after config_dir/skills, so an existing install keeps working while the documented XDG location takes precedence. See Paths::personal_skills_dirs.

§Example

use std::path::PathBuf;
use tinyharness_lib::paths::Paths;

// Drive the library against a sandbox root instead of the real home dir.
let paths = Paths::with_home(PathBuf::from("/tmp/th-profile"));
let store = tinyharness_lib::session::SessionStore::from_paths(&paths);

Structs§

Paths
Every filesystem location TinyHarness needs, fully injectable.