src/backup/catalog.rs - CatalogReader::dump(): use root()

This commit is contained in:
Dietmar Maurer 2019-11-12 12:47:21 +01:00
parent 8f24a9ea18
commit 2ec208aef5
1 changed files with 8 additions and 5 deletions

View File

@ -381,13 +381,16 @@ impl <R: Read + Seek> CatalogReader<R> {
Self { reader }
}
/// Print catalog to stdout
pub fn dump(&mut self) -> Result<(), Error> {
self.reader.seek(SeekFrom::End(-8))?;
let start = unsafe { self.reader.read_le_value::<u64>()? };
self.dump_dir(std::path::Path::new("./"), start)
let root = self.root()?;
match root {
DirEntry { attr: DirEntryAttribute::Directory { start }, .. }=> {
self.dump_dir(std::path::Path::new("./"), start)
}
_ => unreachable!(),
}
}
/// Get the root DirEntry