Add an empty directory to tracking explicitly. This is distinct from `add_to_tree` because it specifically handles empty directories that need to be tracked even without children. The directory will be marked with `DIR_EXPLICIT | DIR_EMPTY` flags. # Arguments `txn` - A mutable transaction `path` - The normalized directory path # Returns The allocated inode for the directory. # Example ```ru
(txn: &mut T, path: &str)
| 620 | /// txn.commit()?; |
| 621 | /// ``` |
| 622 | pub fn add_directory_to_tree<T: MutTxnT>(txn: &mut T, path: &str) -> TrackingResult<Inode> { |
| 623 | // Allocate a new inode |
| 624 | let inode = txn |
| 625 | .alloc_inode() |
| 626 | .map_err(|e| TrackingError::Database(e.to_string()))?; |
| 627 | |
| 628 | TreeProjectionPlan::plan( |
| 629 | txn, |
| 630 | [ |
| 631 | TreeProjectionOperation::Add { |
| 632 | inode, |
| 633 | path: Some(path.to_string()), |
| 634 | position: None, |
| 635 | kind: TreeProjectionKind::Directory, |
| 636 | }, |
| 637 | TreeProjectionOperation::DirectoryOccupancy { inode, empty: true }, |
| 638 | ], |
| 639 | )? |
| 640 | .apply(txn)?; |
| 641 | |
| 642 | Ok(inode) |
| 643 | } |
| 644 | |
| 645 | /// Check if an inode represents a directory. |
| 646 | /// |
no test coverage detected