Descent-based create/update mechanism

This commit is contained in:
Lucien Greathouse
2018-12-14 23:34:31 -08:00
parent f125814847
commit 5707b8c7e8
4 changed files with 48 additions and 12 deletions

View File

@@ -105,6 +105,16 @@ impl Imfs {
Ok(())
}
pub fn get_root_for_path<'a>(&'a self, path: &Path) -> Option<&'a Path> {
for root_path in &self.roots {
if path.starts_with(root_path) {
return Some(root_path);
}
}
None
}
fn remove_item(&mut self, path: &Path) {
if let Some(ImfsItem::Directory(directory)) = self.items.remove(path) {
for child_path in &directory.children {