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

Method parent_path

atomic-core/src/output/repo/tree.rs:627–633  ·  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

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

Callers 1

build_tree_hierarchyFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected