Skip to main content

Dirs

Struct Dirs 

Source
pub struct Dirs<'a, E: EnvSource + ?Sized> { /* private fields */ }
Expand description

A resolver borrowing injectable inputs. Construct it with with_env.

Implementations§

Source§

impl<E: EnvSource + ?Sized> Dirs<'_, E>

Source

pub fn home(&self) -> Result<PathBuf, PathsError>

Unix HOME, or Windows USERPROFILE, then HOMEDRIVE + HOMEPATH, then HOME. USERPROFILE wins over Git Bash’s HOME when both are set. Empty and relative values cannot supply a home directory.

Source

pub fn data_home(&self) -> Result<PathBuf, PathsError>

XDG data home, Unix HOME/.local/share, or Windows local application data. Unlike Self::xdg_data_home, this uses LOCALAPPDATA on Windows when there is no absolute XDG override.

Source

pub fn xdg_data_home(&self) -> Result<PathBuf, PathsError>

XDG data layout on every OS: an absolute XDG_DATA_HOME override, then Self::home plus .local/share. Empty or relative overrides are ignored. Unlike Self::data_home, this never consults APPDATA or LOCALAPPDATA; use it for applications that follow XDG layout even on Windows.

Source

pub fn config_home(&self) -> Result<PathBuf, PathsError>

XDG config home, Unix HOME/.config, or Windows roaming application data.

Source

pub fn state_home(&self) -> Result<PathBuf, PathsError>

XDG state home, Unix HOME/.local/state, or Windows local application data.

Source

pub fn cache_home(&self) -> Result<PathBuf, PathsError>

XDG cache home, Unix HOME/.cache, or Windows local application data.

Source

pub fn cortexkit_data_dir(&self) -> Result<PathBuf, PathsError>

Data home plus cortexkit, preserving an existing roaming Windows install only when no local install exists and no absolute XDG override is set.

Source

pub fn cortexkit_config_dir(&self) -> Result<PathBuf, PathsError>

Config home plus cortexkit.

Source

pub fn cortexkit_run_dir(&self) -> Result<PathBuf, PathsError>

Selected data directory plus run. On Windows this follows the existing roaming installation when no local installation exists; see Self::cortexkit_data_dir.

Source

pub fn cortexkit_state_dir(&self) -> Result<PathBuf, PathsError>

State home plus cortexkit.

Source

pub fn cortexkit_cache_dir(&self) -> Result<PathBuf, PathsError>

Cache home plus cortexkit.

Source

pub fn connection_file_candidates( &self, explicit: Option<&Path>, per_user_token: &str, ) -> Result<Vec<PathBuf>, PathsError>

Ordered transport discovery candidates, without creating or reading files.

An explicit path is exclusive. A relative explicit path (such as a user’s --subc ./conn.json) is joined to the current directory, without requiring the file to exist. Otherwise a non-empty SUBC_CONNECTION_FILE is exclusive and must be absolute: a relative environment override is an error, not a reason to silently try another daemon.

With no override, candidates are XDG_RUNTIME_DIR/subc-connection.json, HOME/.local/share/cortexkit/run/subc-connection.json, then the temporary directory’s subc-{per_user_token}.connection.json. Empty or relative runtime and home values are skipped. The temporary directory must be absolute. The caller supplies the transport’s per-user token, which must be non-empty and contain neither / nor \.

This deliberately retains the transport’s HOME-based discovery order even on Windows; it does not substitute the new local data directory.

Auto Trait Implementations§

§

impl<'a, E> Freeze for Dirs<'a, E>
where &'a E: Freeze, E: ?Sized,

§

impl<'a, E> RefUnwindSafe for Dirs<'a, E>

§

impl<'a, E> Send for Dirs<'a, E>
where &'a E: Send, E: ?Sized,

§

impl<'a, E> Sync for Dirs<'a, E>
where &'a E: Sync, E: ?Sized,

§

impl<'a, E> Unpin for Dirs<'a, E>
where &'a E: Unpin, E: ?Sized,

§

impl<'a, E> UnsafeUnpin for Dirs<'a, E>
where &'a E: UnsafeUnpin, E: ?Sized,

§

impl<'a, E> UnwindSafe for Dirs<'a, E>
where &'a E: UnwindSafe, E: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.