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>
impl<E: EnvSource + ?Sized> Dirs<'_, E>
Sourcepub fn home(&self) -> Result<PathBuf, PathsError>
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.
Sourcepub fn data_home(&self) -> Result<PathBuf, PathsError>
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.
Sourcepub fn xdg_data_home(&self) -> Result<PathBuf, PathsError>
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.
Sourcepub fn config_home(&self) -> Result<PathBuf, PathsError>
pub fn config_home(&self) -> Result<PathBuf, PathsError>
XDG config home, Unix HOME/.config, or Windows roaming application data.
Sourcepub fn state_home(&self) -> Result<PathBuf, PathsError>
pub fn state_home(&self) -> Result<PathBuf, PathsError>
XDG state home, Unix HOME/.local/state, or Windows local application data.
Sourcepub fn cache_home(&self) -> Result<PathBuf, PathsError>
pub fn cache_home(&self) -> Result<PathBuf, PathsError>
XDG cache home, Unix HOME/.cache, or Windows local application data.
Sourcepub fn cortexkit_data_dir(&self) -> Result<PathBuf, PathsError>
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.
Sourcepub fn cortexkit_config_dir(&self) -> Result<PathBuf, PathsError>
pub fn cortexkit_config_dir(&self) -> Result<PathBuf, PathsError>
Config home plus cortexkit.
Sourcepub fn cortexkit_run_dir(&self) -> Result<PathBuf, PathsError>
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.
Sourcepub fn cortexkit_state_dir(&self) -> Result<PathBuf, PathsError>
pub fn cortexkit_state_dir(&self) -> Result<PathBuf, PathsError>
State home plus cortexkit.
Sourcepub fn cortexkit_cache_dir(&self) -> Result<PathBuf, PathsError>
pub fn cortexkit_cache_dir(&self) -> Result<PathBuf, PathsError>
Cache home plus cortexkit.
Sourcepub fn connection_file_candidates(
&self,
explicit: Option<&Path>,
per_user_token: &str,
) -> Result<Vec<PathBuf>, PathsError>
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.