MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / overlaps

Method overlaps

crates/opencode-util/src/filesystem.rs:37–51  ·  view source on GitHub ↗
(a: &str, b: &str)

Source from the content-addressed store, hash-verified

35 }
36
37 pub fn overlaps(a: &str, b: &str) -> bool {
38 let path_a = Path::new(a);
39 let path_b = Path::new(b);
40
41 let rel_a = path_a.strip_prefix(path_b).unwrap_or(path_a);
42 let rel_b = path_b.strip_prefix(path_a).unwrap_or(path_b);
43
44 let rel_a_str = rel_a.to_string_lossy();
45 let rel_b_str = rel_b.to_string_lossy();
46
47 !rel_a_str.starts_with("..")
48 || !rel_b_str.starts_with("..")
49 || rel_a_str.is_empty()
50 || rel_b_str.is_empty()
51 }
52
53 pub fn contains(parent: &str, child: &str) -> bool {
54 let parent_path = Path::new(parent);

Callers

nothing calls this directly

Calls 2

newFunction · 0.85
is_emptyMethod · 0.80

Tested by

no test coverage detected