This commit is contained in:
João Marcos 2025-05-03 19:46:10 -03:00
parent 26535e4b8d
commit 4c6164801a
5 changed files with 14 additions and 15 deletions

View File

@ -1,7 +1,7 @@
use crate::Error;
pub fn no_support() -> Error {
Error::UnsupportedFormat {
reason: "BZip3 support is disabled for this build, possibly due to missing bindgen-cli dependency.".into(),
}
}
use crate::Error;
pub fn no_support() -> Error {
Error::UnsupportedFormat {
reason: "BZip3 support is disabled for this build, possibly due to missing bindgen-cli dependency.".into(),
}
}

View File

@ -1,5 +1,7 @@
//! Archive compression algorithms
#[cfg(not(feature = "bzip3"))]
pub mod bzip3_stub;
#[cfg(feature = "unrar")]
pub mod rar;
#[cfg(not(feature = "unrar"))]
@ -7,5 +9,3 @@ pub mod rar_stub;
pub mod sevenz;
pub mod tar;
pub mod zip;
#[cfg(not(feature = "bzip3"))]
pub mod bzip3_stub;

View File

@ -66,7 +66,7 @@ pub fn compress_files(
// Use block size of 16 MiB
bzip3::write::Bz3Encoder::new(encoder, 16 * 2_usize.pow(20))?,
)
},
}
Lz4 => Box::new(lz4_flex::frame::FrameEncoder::new(encoder).auto_finish()),
Lzma => Box::new(xz2::write::XzEncoder::new(
encoder,

View File

@ -6,6 +6,8 @@ use std::{
use fs_err as fs;
#[cfg(not(feature = "bzip3"))]
use crate::archive;
use crate::{
commands::{warn_user_about_loading_sevenz_in_memory, warn_user_about_loading_zip_in_memory},
extension::{
@ -23,9 +25,6 @@ use crate::{
QuestionAction, QuestionPolicy, BUFFER_CAPACITY,
};
#[cfg(not(feature = "bzip3"))]
use crate::archive;
trait ReadSeek: Read + io::Seek {}
impl<T: Read + io::Seek> ReadSeek for T {}
@ -127,7 +126,7 @@ pub fn decompress_file(options: DecompressOptions) -> crate::Result<()> {
#[cfg(feature = "bzip3")]
Box::new(bzip3::read::Bz3Decoder::new(decoder)?)
},
}
Lz4 => Box::new(lz4_flex::frame::FrameDecoder::new(decoder)),
Lzma => Box::new(xz2::read::XzDecoder::new(decoder)),
Snappy => Box::new(snap::read::FrameDecoder::new(decoder)),

View File

@ -56,7 +56,7 @@ pub fn list_archive_contents(
#[cfg(feature = "bzip3")]
Box::new(bzip3::read::Bz3Decoder::new(decoder).unwrap())
},
}
Lz4 => Box::new(lz4_flex::frame::FrameDecoder::new(decoder)),
Lzma => Box::new(xz2::read::XzDecoder::new(decoder)),
Snappy => Box::new(snap::read::FrameDecoder::new(decoder)),