Skip to main content

expand_store_root

Function expand_store_root 

Source
pub fn expand_store_root(raw: &str) -> Utf8PathBuf
Expand description

Turn a raw [store] root value into a path, expanding a leading ~.

A config file has no shell, so ~/papers written there would otherwise become a literal directory named ~ next to the cwd — a silent wrong answer of exactly the kind #441 was about. DOIGET_STORE_ROOT needs no equivalent because the shell expands it before the process starts.

Kept out of the parser so parsing stays a pure function of the file text; both the CLI and the MCP resolver call this at the point of use, which is also what keeps their two answers identical.

Falls back to the value verbatim when neither HOME nor USERPROFILE is set — a wrong path the user can see beats a silent substitution.