Skip to main content

file_store_root

Function file_store_root 

Source
pub fn file_store_root(store: &Store) -> PathBuf
Expand description

The file store’s root directory (RFC 0033 §4), first that applies: store.file.path, $AGENTD_STATE_DIR, $XDG_STATE_HOME/agentd/state, $HOME/.local/state/agentd/state, else the OS temp dir.

This is deliberately the same chain — and the same order — that crate::auth::cache::default_dir uses for the credential cache, one sibling over (state beside creds): an operator who has learned where agentd keeps its tokens already knows where it keeps its state, and one XDG_STATE_HOME moves both. Resolution lives here, next to the schema, so the startup log, --capabilities and crate::store::open all name the one directory instead of each re-deriving it.

The last resort is the OS temp dir: a store that is there survives a process restart but not a reboot, which is why the runtime logs the resolved path and whether it was defaulted (RFC 0033 §5.1) rather than letting a user believe more than the filesystem delivers.