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

Function expand_target

atomic-agent/src/hooks/manifest.rs:192–209  ·  view source on GitHub ↗
(target: &str)

Source from the content-addressed store, hash-verified

190}
191
192fn expand_target(target: &str) -> AgentResult<PathBuf> {
193 if target == "~" {
194 return dirs::home_dir().ok_or_else(|| AgentError::ConfigError {
195 operation: "resolve home".to_string(),
196 path: PathBuf::from(target),
197 reason: "could not determine home directory".to_string(),
198 });
199 }
200 if let Some(rest) = target.strip_prefix("~/") {
201 let home = dirs::home_dir().ok_or_else(|| AgentError::ConfigError {
202 operation: "resolve home".to_string(),
203 path: PathBuf::from(target),
204 reason: "could not determine home directory".to_string(),
205 })?;
206 return Ok(home.join(rest));
207 }
208 Ok(PathBuf::from(target))
209}
210
211fn read_json_object(path: &Path) -> AgentResult<Map<String, Value>> {
212 if !path.exists() {

Callers 2

install_from_manifestFunction · 0.85
uninstall_from_manifestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected