MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / parent_dir

Function parent_dir

compiler/src/modules/packages/manifest.rs:85–98  ·  view source on GitHub ↗
(dir: &str)

Source from the content-addressed store, hash-verified

83}
84
85fn parent_dir(dir: &str) -> Option<String> {
86 if dir.is_empty() { return None; }
87 let trimmed = dir.trim_end_matches('/');
88 // URL guard: never strip the host. After "scheme://" there must still be a '/' to walk into.
89 if let Some(scheme_end) = trimmed.find("://") {
90 let after = &trimmed[scheme_end + 3..];
91 if !after.contains('/') { return None; }
92 }
93 match trimmed.rsplit_once('/') {
94 Some(("", _)) => Some(String::new()),
95 Some((head, _)) => Some(s!(str head, "/")),
96 None => Some(String::new()),
97 }
98}
99
100struct Reader<'a> {
101 src: &'a [u8],

Callers 2

walk_up_dirsFunction · 0.85
join_relativeFunction · 0.85

Calls 2

is_emptyMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected