Add logging, fix flipped condition on child add

This commit is contained in:
Lucien Greathouse
2019-10-16 18:28:11 -07:00
parent 64fd2f9cf8
commit a5fdc2a9cc

View File

@@ -167,6 +167,11 @@ impl<F: VfsFetcher> Vfs<F> {
let path = path.as_ref(); let path = path.as_ref();
if !Self::would_be_resident(&data, path) { if !Self::would_be_resident(&data, path) {
log::trace!(
"Path would not be resident, skipping change: {}",
path.display()
);
return Ok(()); return Ok(());
} }
@@ -205,6 +210,7 @@ impl<F: VfsFetcher> Vfs<F> {
} }
} }
None => { None => {
log::trace!("Inserting new path {}", path.display());
data.insert(path.to_path_buf(), VfsItem::new_from_type(new_type, path)); data.insert(path.to_path_buf(), VfsItem::new_from_type(new_type, path));
} }
} }
@@ -266,7 +272,7 @@ impl<F: VfsFetcher> Vfs<F> {
if let Some(parent) = path.parent() { if let Some(parent) = path.parent() {
if let Some(VfsItem::Directory(dir)) = data.get(parent) { if let Some(VfsItem::Directory(dir)) = data.get(parent) {
return !dir.children_enumerated; return dir.children_enumerated;
} }
} }
@@ -400,6 +406,7 @@ impl VfsEntry {
/// Internal structure describing potentially partially-resident files and /// Internal structure describing potentially partially-resident files and
/// folders in the `Vfs`. /// folders in the `Vfs`.
#[derive(Debug)]
pub enum VfsItem { pub enum VfsItem {
File(VfsFile), File(VfsFile),
Directory(VfsDirectory), Directory(VfsDirectory),
@@ -427,11 +434,13 @@ impl VfsItem {
} }
} }
#[derive(Debug)]
pub struct VfsFile { pub struct VfsFile {
pub(super) path: PathBuf, pub(super) path: PathBuf,
pub(super) contents: Option<Arc<Vec<u8>>>, pub(super) contents: Option<Arc<Vec<u8>>>,
} }
#[derive(Debug)]
pub struct VfsDirectory { pub struct VfsDirectory {
pub(super) path: PathBuf, pub(super) path: PathBuf,
pub(super) children_enumerated: bool, pub(super) children_enumerated: bool,