Support reading thin archives in ArArchiveBuilder

This commit is contained in:
bjorn3 2024-08-10 17:42:56 +00:00
parent 8291d68d92
commit 4f8042e22e

View File

@ -307,12 +307,19 @@ impl<'a> ArchiveBuilder for ArArchiveBuilder<'a> {
let file_name = String::from_utf8(entry.name().to_vec())
.map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err))?;
if !skip(&file_name) {
if entry.is_thin() {
self.entries.push((
file_name.clone().into_bytes(),
ArchiveEntry::File(PathBuf::from(file_name)),
));
} else {
self.entries.push((
file_name.into_bytes(),
ArchiveEntry::FromArchive { archive_index, file_range: entry.file_range() },
));
}
}
}
self.src_archives.push((archive_path, archive_map));
Ok(())