MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / resolve

Method resolve

src/storage.rs:367–405  ·  view source on GitHub ↗
(project_root: &Path, path: &Path)

Source from the content-addressed store, hash-verified

365
366impl ProjectPath {
367 pub fn resolve(project_root: &Path, path: &Path) -> Result<Self> {
368 validate_no_nul(path)?;
369 validate_normal_components(path, true)?;
370 let root = project_root
371 .canonicalize()
372 .map_err(|e| TraceDecayError::Config {
373 message: format!(
374 "failed to canonicalize project root '{}': {e}",
375 project_root.display()
376 ),
377 })?;
378 let candidate = if path.is_absolute() {
379 path.to_path_buf()
380 } else {
381 project_root.join(path)
382 };
383 let absolute_path = candidate
384 .canonicalize()
385 .map_err(|e| TraceDecayError::Config {
386 message: format!(
387 "failed to canonicalize project path '{}': {e}",
388 candidate.display()
389 ),
390 })?;
391 let relative_path = absolute_path
392 .strip_prefix(&root)
393 .map_err(|_| TraceDecayError::Config {
394 message: format!(
395 "path '{}' escapes project root '{}'",
396 path.display(),
397 project_root.display()
398 ),
399 })?
400 .to_path_buf();
401 Ok(Self {
402 absolute_path,
403 relative_path,
404 })
405 }
406
407 pub fn absolute_path(&self) -> PathBuf {
408 self.absolute_path.clone()

Callers 15

run_real_model.pyFile · 0.80
evaluate_assertionsFunction · 0.80
prepare-release.pyFile · 0.80
generate_pluginFunction · 0.80
run_checksFunction · 0.80
probe.pyFile · 0.80
isolated.pyFile · 0.80
run.mjsFile · 0.80
shutdownFunction · 0.80
loadBundledTableFunction · 0.80
libFunction · 0.80

Calls 3

validate_no_nulFunction · 0.85

Tested by 4

loadBundledTableFunction · 0.64
libFunction · 0.64
withMockedFetchFunction · 0.64
loadWrapperFunction · 0.64