mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-22 13:45:16 +00:00
Implement more tests, fix up removal
This commit is contained in:
@@ -93,16 +93,12 @@ impl Imfs {
|
||||
debug_assert!(path.is_absolute());
|
||||
debug_assert!(self.is_within_roots(path));
|
||||
|
||||
self.remove_item(path);
|
||||
|
||||
if let Some(parent_path) = path.parent() {
|
||||
self.unlink_child(parent_path, path);
|
||||
}
|
||||
|
||||
if let Some(ImfsItem::Directory(directory)) = self.items.remove(path) {
|
||||
for child_path in &directory.children {
|
||||
self.path_removed(child_path)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -117,6 +113,14 @@ impl Imfs {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn remove_item(&mut self, path: &Path) {
|
||||
if let Some(ImfsItem::Directory(directory)) = self.items.remove(path) {
|
||||
for child_path in &directory.children {
|
||||
self.remove_item(child_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn unlink_child(&mut self, parent: &Path, child: &Path) {
|
||||
let parent_item = self.items.get_mut(parent);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user