MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / path_parent

Function path_parent

atomic-core/src/output/memory.rs:694–700  ·  view source on GitHub ↗

Get the parent path of a file path. Returns `None` if the path has no parent (is a top-level file).

(path: &str)

Source from the content-addressed store, hash-verified

692///
693/// Returns `None` if the path has no parent (is a top-level file).
694fn path_parent(path: &str) -> Option<String> {
695 let path = path.trim_end_matches('/');
696 match path.rfind('/') {
697 Some(pos) if pos > 0 => Some(path[..pos].to_string()),
698 _ => None,
699 }
700}
701
702// TESTS
703

Callers 2

add_fileMethod · 0.85
write_fileMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected