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
impl Paths
Sourcepub fn new(home: impl Into<PathBuf>) -> Self
pub fn new(home: impl Into<PathBuf>) -> Self
The legacy layout: every category under ~/.purple.
Sourcepub fn resolve(
home: impl Into<PathBuf>,
var: impl Fn(&str) -> Option<String>,
) -> Self
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.
pub fn home(&self) -> &Path
Sourcepub fn legacy_dir(&self) -> PathBuf
pub fn legacy_dir(&self) -> PathBuf
~/.purple, the single directory every category used before the
split. Only the migration reads from here.
Sourcepub fn config_dir(&self) -> &Path
pub fn config_dir(&self) -> &Path
Preferences, snippets, providers and themes.
Sourcepub fn preferences(&self) -> PathBuf
pub fn preferences(&self) -> PathBuf
<config>/preferences.
Sourcepub fn snippets_file(&self) -> PathBuf
pub fn snippets_file(&self) -> PathBuf
<config>/snippets, the INI-style snippet store.
Sourcepub fn providers_config(&self) -> PathBuf
pub fn providers_config(&self) -> PathBuf
<config>/providers, the provider config file.
Sourcepub fn themes_dir(&self) -> PathBuf
pub fn themes_dir(&self) -> PathBuf
<config>/themes, the custom theme directory.
Sourcepub fn config_original(&self) -> PathBuf
pub fn config_original(&self) -> PathBuf
<data>/config.original, the untouched SSH config backup taken on
the first launch.
Sourcepub fn key_activity(&self) -> PathBuf
pub fn key_activity(&self) -> PathBuf
<state>/key_activity.json.
Sourcepub fn snippet_runs(&self) -> PathBuf
pub fn snippet_runs(&self) -> PathBuf
<state>/snippet_runs.json.
Sourcepub fn sync_history(&self) -> PathBuf
pub fn sync_history(&self) -> PathBuf
<state>/sync_history.tsv.
Sourcepub fn mcp_audit_log(&self) -> PathBuf
pub fn mcp_audit_log(&self) -> PathBuf
<state>/mcp-audit.log.
Sourcepub fn askpass_marker(&self, alias: &str) -> PathBuf
pub fn askpass_marker(&self, alias: &str) -> PathBuf
Askpass retry marker <state>/.askpass_<safe>. The alias is
sanitized (/, \, . become _) to prevent path traversal.
Sourcepub fn askpass_withheld_marker(&self, alias: &str) -> PathBuf
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.
Sourcepub fn askpass_pin_request_marker(&self, flow: &str, alias: &str) -> PathBuf
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.
Sourcepub fn askpass_pin_used_marker(&self, alias: &str) -> PathBuf
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.
Sourcepub fn askpass_pin_refused_marker(&self, key_digest: &str) -> PathBuf
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.
Sourcepub fn askpass_pin_last_marker(&self, key_digest: &str) -> PathBuf
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.
Sourcepub fn askpass_pin_lock_marker(&self, key_digest: &str) -> PathBuf
pub fn askpass_pin_lock_marker(&self, key_digest: &str) -> PathBuf
Lock file that queues the hand-outs of one security key’s PIN.
Sourcepub fn container_cache(&self) -> PathBuf
pub fn container_cache(&self) -> PathBuf
<cache>/container_cache.jsonl.
Sourcepub fn last_version_check(&self) -> PathBuf
pub fn last_version_check(&self) -> PathBuf
<cache>/last_version_check.
Sourcepub fn aws_credentials_file(&self) -> PathBuf
pub fn aws_credentials_file(&self) -> PathBuf
~/.aws/credentials, the shared AWS credentials file.
Sourcepub fn aws_config_file(&self) -> PathBuf
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.
Sourcepub fn abbreviate_home(&self, path: &Path) -> String
pub fn abbreviate_home(&self, path: &Path) -> String
path for display, with the home directory abbreviated to ~.
Trait Implementations§
impl Eq for Paths
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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