MCPcopy Create free account
hub / github.com/dallay/agentsync / get_canonical_project_root

Method get_canonical_project_root

src/linker.rs:120–136  ·  view source on GitHub ↗

Get or compute the canonical project root path, using cache.

(&self)

Source from the content-addressed store, hash-verified

118
119 /// Get or compute the canonical project root path, using cache.
120 fn get_canonical_project_root(&self) -> Result<PathBuf> {
121 let mut root_cache = self.canonical_project_root.borrow_mut();
122 if let Some(ref root) = *root_cache {
123 return Ok(root.clone());
124 }
125
126 let root = self
127 .canonicalize_uncached(&self.project_root)
128 .with_context(|| {
129 format!(
130 "Failed to canonicalize project root: {}",
131 self.project_root.display()
132 )
133 })?;
134 *root_cache = Some(root.clone());
135 Ok(root)
136 }
137
138 /// Validate that a path resolves within the project root and contains no traversal.
139 fn ensure_safe_path(&self, joined: &Path, display_path: &str) -> Result<PathBuf> {

Callers 2

ensure_safe_pathMethod · 0.80

Calls 1

canonicalize_uncachedMethod · 0.80

Tested by

no test coverage detected