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

Function paths_equal

src/sessions/shared.rs:121–126  ·  view source on GitHub ↗

Compare two paths for equality, canonicalizing when possible so that symlinks/`..`/trailing differences do not cause false mismatches. Falls back to a literal comparison when canonicalization fails (e.g. a path that no longer exists).

(a: &Path, b: &Path)

Source from the content-addressed store, hash-verified

119/// to a literal comparison when canonicalization fails (e.g. a path that no
120/// longer exists).
121pub(crate) fn paths_equal(a: &Path, b: &Path) -> bool {
122 match (a.canonicalize(), b.canonicalize()) {
123 (Ok(a), Ok(b)) => normalized_paths_equal(&a, &b),
124 _ => normalized_paths_equal(a, b),
125 }
126}
127
128pub(crate) fn path_belongs_to_project(path: &Path, project_root: &Path) -> bool {
129 ProjectRootMatcher::new(project_root).contains(path)

Callers 5

pinned_state_dbsFunction · 0.85
transcript_pathsMethod · 0.85
event_projectFunction · 0.85
containsMethod · 0.85

Calls 1

normalized_paths_equalFunction · 0.85

Tested by

no test coverage detected