Skip to main content

Paths

Struct Paths 

Source
pub struct Paths { /* private fields */ }
Expand description

Home-derived file locations under ~/.purple and ~/.ssh. One place that knows the on-disk layout; every consumer asks here instead of joining the home directory itself.

The purple files live in four category directories (see Category). Paths::new puts all four at ~/.purple; Paths::resolve honors the PURPLE_*_DIR and XDG_*_HOME variables per category.

Implementations§

Source§

impl Paths

Source

pub fn new(home: impl Into<PathBuf>) -> Self

The legacy layout: every category under ~/.purple.

Source

pub fn resolve( home: impl Into<PathBuf>, var: impl Fn(&str) -> Option<String>, ) -> Self

Resolve each category directory from the environment. Precedence per category: PURPLE_<CATEGORY>_DIR when set and non-empty (a leading ~/ expands to the home directory), then $XDG_<CATEGORY>_HOME/purple when that variable is set, non-empty and absolute (a relative XDG path is invalid per the spec and ignored), else the legacy ~/.purple.

Source

pub fn home(&self) -> &Path

Source

pub fn legacy_dir(&self) -> PathBuf

~/.purple, the single directory every category used before the split. Only the migration reads from here.

Source

pub fn dir(&self, category: Category) -> &Path

The directory a category resolved to.

Source

pub fn config_dir(&self) -> &Path

Preferences, snippets, providers and themes.

Source

pub fn data_dir(&self) -> &Path

Signed certificates and the original SSH config backup.

Source

pub fn state_dir(&self) -> &Path

History, recents, ledgers, logs and retry markers.

Source

pub fn cache_dir(&self) -> &Path

Container cache and version check.

Source

pub fn is_split(&self) -> bool

True when at least one category lives outside ~/.purple.

Source

pub fn preferences(&self) -> PathBuf

<config>/preferences.

Source

pub fn snippets_file(&self) -> PathBuf

<config>/snippets, the INI-style snippet store.

Source

pub fn providers_config(&self) -> PathBuf

<config>/providers, the provider config file.

Source

pub fn themes_dir(&self) -> PathBuf

<config>/themes, the custom theme directory.

Source

pub fn certs_dir(&self) -> PathBuf

<data>/certs.

Source

pub fn cert_for(&self, alias: &str) -> PathBuf

<data>/certs/<alias>-cert.pub.

Source

pub fn config_original(&self) -> PathBuf

<data>/config.original, the untouched SSH config backup taken on the first launch.

Source

pub fn history(&self) -> PathBuf

<state>/history.tsv.

Source

pub fn recents(&self) -> PathBuf

<state>/recents.json.

Source

pub fn key_activity(&self) -> PathBuf

<state>/key_activity.json.

Source

pub fn snippet_runs(&self) -> PathBuf

<state>/snippet_runs.json.

Source

pub fn sync_history(&self) -> PathBuf

<state>/sync_history.tsv.

Source

pub fn log_file(&self) -> PathBuf

<state>/purple.log.

Source

pub fn mcp_audit_log(&self) -> PathBuf

<state>/mcp-audit.log.

Source

pub fn askpass_marker(&self, alias: &str) -> PathBuf

Askpass retry marker <state>/.askpass_<safe>. The alias is sanitized (/, \, . become _) to prevent path traversal.

Source

pub fn askpass_withheld_marker(&self, alias: &str) -> PathBuf

Marker recording that a background run met a prompt it could not place. The dot after withheld keeps this apart from a retry marker, whose own sanitizer turns every dot into an underscore. The alias is percent-encoded rather than flattened, so web.prod and web_prod keep their own file and neither can walk out of the state directory.

Source

pub fn askpass_pin_request_marker(&self, flow: &str, alias: &str) -> PathBuf

Marker recording that a background run met a security key PIN prompt it had no PIN for. Keyed on the flow that ran it, so a container refresh never answers for a tunnel. Holds the key path.

Source

pub fn askpass_pin_used_marker(&self, alias: &str) -> PathBuf

Marker listing which ssh process received which security key PIN for alias, one <pid>\t<key path> line each.

Source

pub fn askpass_pin_refused_marker(&self, key_digest: &str) -> PathBuf

Marker recording that a security key refused the PIN purple handed out. Keyed on a digest of the key path, which is free to be long.

Source

pub fn askpass_pin_last_marker(&self, key_digest: &str) -> PathBuf

Marker whose mtime is the last time askpass handed out the PIN of one security key, in any run. Keyed on the key path digest.

Source

pub fn askpass_pin_lock_marker(&self, key_digest: &str) -> PathBuf

Lock file that queues the hand-outs of one security key’s PIN.

Source

pub fn container_cache(&self) -> PathBuf

<cache>/container_cache.jsonl.

Source

pub fn last_version_check(&self) -> PathBuf

<cache>/last_version_check.

Source

pub fn aws_credentials_file(&self) -> PathBuf

~/.aws/credentials, the shared AWS credentials file.

Source

pub fn aws_config_file(&self) -> PathBuf

~/.aws/config, the shared AWS config file. Named profiles live here as [profile <name>], and it is the only file that carries the assume-role keys.

Source

pub fn ssh_dir(&self) -> PathBuf

~/.ssh.

Source

pub fn abbreviate_home(&self, path: &Path) -> String

path for display, with the home directory abbreviated to ~.

Trait Implementations§

Source§

impl Clone for Paths

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Paths

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Paths

Source§

impl PartialEq for Paths

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Paths

Auto Trait Implementations§

§

impl Freeze for Paths

§

impl RefUnwindSafe for Paths

§

impl Send for Paths

§

impl Sync for Paths

§

impl Unpin for Paths

§

impl UnsafeUnpin for Paths

§

impl UnwindSafe for Paths

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V