Skip to main content

lean_ctx_data_dir

Function lean_ctx_data_dir 

Source
pub fn lean_ctx_data_dir() -> Result<PathBuf, String>
Expand description

Resolve the lean-ctx data directory.

Priority order (backward-compatible XDG split, GH #408):

  1. LEAN_CTX_DATA_DIR env var (explicit override)
  2. ~/.lean-ctx if it has actual data (legacy installs)
  3. $XDG_CONFIG_HOME/lean-ctx if it has actual data (pre-split installs that mixed data into the config dir — kept in place, never silently moved)
  4. $XDG_DATA_HOME/lean-ctx (default ~/.local/share/lean-ctx) for fresh installs, so the config dir holds only config and stays RO-sandbox-safe.

An empty ~/.lean-ctx/ directory does NOT trigger legacy mode — this prevents data directory splits when setup creates the dir before MCP writes stats.