pub struct Locator { /* private fields */ }Expand description
Resolves every filesystem location the application uses from a small set of
roots plus the BRAND naming constants. Construct one per process (or one
per sandbox in tests). Path methods are pure and cheap; the ensure_*
methods are the only ones that touch disk.
Implementations§
Source§impl Locator
impl Locator
Sourcepub fn new(overrides: LocatorOverrides) -> Self
pub fn new(overrides: LocatorOverrides) -> Self
Construct a locator against the canonical BRAND, with the given
overrides layered on the live-process defaults.
Sourcepub fn with_brand(overrides: LocatorOverrides, brand: Brand) -> Self
pub fn with_brand(overrides: LocatorOverrides, brand: Brand) -> Self
Construct a locator against an explicit brand (injectable so an
alternate identity can be resolved without mutating the global).
Sourcepub fn profile_dir(&self) -> PathBuf
pub fn profile_dir(&self) -> PathBuf
The per-user profile directory under the home root (e.g. ~/.indusagi).
Sourcepub fn settings_path(&self) -> PathBuf
pub fn settings_path(&self) -> PathBuf
The global settings file inside the profile (e.g. ~/.indusagi/settings.json).
Sourcepub fn project_settings_path(&self, cwd: Option<&Path>) -> PathBuf
pub fn project_settings_path(&self, cwd: Option<&Path>) -> PathBuf
The per-project settings file for a working directory. A relative cwd
is resolved against the locator’s bound working directory.
Sourcepub fn sessions_dir(&self) -> PathBuf
pub fn sessions_dir(&self) -> PathBuf
Directory holding persisted conversation sessions (e.g. ~/.indusagi/sessions).
Sourcepub fn auth_store_path(&self) -> PathBuf
pub fn auth_store_path(&self) -> PathBuf
The credential/auth store file inside the profile (e.g. ~/.indusagi/auth.json).
Sourcepub fn logs_dir(&self) -> PathBuf
pub fn logs_dir(&self) -> PathBuf
Directory holding diagnostic and crash logs (e.g. ~/.indusagi/logs).
Sourcepub async fn ensure_profile_dir(&self) -> Result<PathBuf>
pub async fn ensure_profile_dir(&self) -> Result<PathBuf>
Ensure the profile directory exists; returns its path.
Sourcepub async fn ensure_sessions_dir(&self) -> Result<PathBuf>
pub async fn ensure_sessions_dir(&self) -> Result<PathBuf>
Ensure the sessions directory exists; returns its path.
Sourcepub async fn ensure_logs_dir(&self) -> Result<PathBuf>
pub async fn ensure_logs_dir(&self) -> Result<PathBuf>
Ensure the logs directory exists; returns its path.
Sourcepub async fn ensure_parent_of(&self, file_path: PathBuf) -> Result<PathBuf>
pub async fn ensure_parent_of(&self, file_path: PathBuf) -> Result<PathBuf>
Ensure the parent directory of file_path exists, then return
file_path unchanged (use before writing settings/auth files).
Sourcepub async fn ensure_dir(&self, dir: PathBuf) -> Result<PathBuf>
pub async fn ensure_dir(&self, dir: PathBuf) -> Result<PathBuf>
Create dir and any missing parents idempotently; returns its path.