small cleanups

This commit is contained in:
figsoda 2023-05-24 10:54:39 -04:00 committed by João Marcos
parent 4bea6af526
commit 8023a9157e
2 changed files with 4 additions and 3 deletions

View File

@ -26,6 +26,7 @@ lz4_flex = "0.11.1"
once_cell = "1.18.0"
rayon = "1.8.0"
same-file = "1.0.6"
sevenz-rust = {version = "0.2.10", features = ["compress"]}
snap = "1.1.0"
tar = "0.4.40"
tempfile = "3.8.1"

View File

@ -95,17 +95,17 @@ pub fn list_archive_contents(
}
}
let mut a = Vec::new();
let mut files = Vec::new();
sevenz_rust::decompress_file_with_extract_fn(archive_path, ".", |entry, _, _| {
a.push(Ok(FileInArchive {
files.push(Ok(FileInArchive {
path: entry.name().into(),
is_dir: entry.is_directory(),
}));
Ok(true)
})
.map_err(crate::Error::SevenzipError)?;
Box::new(a.into_iter())
Box::new(files.into_iter())
}
Gzip | Bzip | Lz4 | Lzma | Snappy | Zstd => {
panic!("Not an archive! This should never happen, if it does, something is wrong with `CompressionFormat::is_archive()`. Please report this error!");