Skip to main content

default_sessions_root

Function default_sessions_root 

Source
pub fn default_sessions_root() -> Result<PathBuf>
Expand description

Default session persistence root directory, resolved via the platform’s standard per-app state/data location (the directories crate):

  • Linux: $XDG_STATE_HOME/defect/sessions (or ~/.local/state/defect/sessions)
  • macOS: ~/Library/Application Support/defect/sessions
  • Windows: %LOCALAPPDATA%\defect\sessions

On Linux state_dir() follows XDG; on macOS/Windows there is no separate state directory, so we fall back to the per-app data directory.

§Errors

Returns an error when no home directory can be determined at all (e.g. a stripped environment with no HOME on Unix or no profile dir on Windows) — in that case the OS itself cannot tell us where per-user data belongs.