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

Function expand_target

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

Source from the content-addressed store, hash-verified

228}
229
230fn expand_target(target: &str) -> AgentResult<PathBuf> {
231 if target == "~" {
232 return dirs::home_dir().ok_or_else(|| AgentError::ConfigError {
233 operation: "resolve home".to_string(),
234 path: PathBuf::from(target),
235 reason: "could not determine home directory".to_string(),
236 });
237 }
238 if let Some(rest) = target.strip_prefix("~/") {
239 let home = dirs::home_dir().ok_or_else(|| AgentError::ConfigError {
240 operation: "resolve home".to_string(),
241 path: PathBuf::from(target),
242 reason: "could not determine home directory".to_string(),
243 })?;
244 return Ok(home.join(rest));
245 }
246 Ok(PathBuf::from(target))
247}
248
249fn read_json_object(path: &Path) -> AgentResult<Map<String, Value>> {
250 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