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

Method parent_path

atomic-core/src/output/repo/tree.rs:622–628  ·  view source on GitHub ↗

Get the parent directory path. # Returns The parent directory, or empty string if at root. # Example ```rust use atomic_core::output::repo::TreeItem; use atomic_core::types::{Inode, Position}; let item = TreeItem::file("src/lib/mod.rs", Inode::ROOT, Position::ROOT); assert_eq!(item.parent_path(), "src/lib"); let root_file = TreeItem::file("Cargo.toml", Inode::ROOT, Position::ROOT); assert_eq

(&self)

Source from the content-addressed store, hash-verified

620 /// assert_eq!(root_file.parent_path(), "");
621 /// ```
622 pub fn parent_path(&self) -> &str {
623 if let Some(idx) = self.path.rfind('/') {
624 &self.path[..idx]
625 } else {
626 ""
627 }
628 }
629
630 /// Check if this item is hidden (filename starts with '.').
631 ///

Callers 1

build_tree_hierarchyFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected