MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / expand_dst

Function expand_dst

atomic-agent/src/integrations/install.rs:551–567  ·  view source on GitHub ↗

Expand a leading `~` in a destination path.

(dst: &str)

Source from the content-addressed store, hash-verified

549
550/// Expand a leading `~` in a destination path.
551fn expand_dst(dst: &str) -> AgentResult<PathBuf> {
552 if dst == "~" {
553 return dirs::home_dir().ok_or_else(|| AgentError::Integration {
554 agent: "<any>".to_string(),
555 reason: "cannot resolve home directory".to_string(),
556 });
557 }
558 if let Some(rest) = dst.strip_prefix("~/") {
559 return dirs::home_dir()
560 .map(|h| h.join(rest))
561 .ok_or_else(|| AgentError::Integration {
562 agent: "<any>".to_string(),
563 reason: "cannot resolve home directory".to_string(),
564 });
565 }
566 Ok(PathBuf::from(dst))
567}
568
569/// Resolve a `[[repo-file]]` destination against the repository root.
570/// `dst` must be a relative path (no `~`, no absolute) — it lands inside the

Callers 1

install_from_dirFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected