diff --git a/repak/src/pak.rs b/repak/src/pak.rs index 29e7bfa..7d14c81 100644 --- a/repak/src/pak.rs +++ b/repak/src/pak.rs @@ -16,12 +16,12 @@ impl PakBuilder { } } #[cfg(feature = "encryption")] - pub fn key(&mut self, key: aes::Aes256) -> &mut Self { + pub fn key(mut self, key: aes::Aes256) -> Self { self.key = super::Key::Some(key); self } #[cfg(feature = "oodle")] - pub fn oodle(&mut self, oodle: fn() -> super::Decompress) -> &mut Self { + pub fn oodle(self, oodle: fn() -> super::Decompress) -> Self { unsafe { super::OODLE = Some(once_cell::sync::Lazy::new(oodle)) } self } diff --git a/repak_cli/src/main.rs b/repak_cli/src/main.rs index c7e5dfc..6a6b62f 100644 --- a/repak_cli/src/main.rs +++ b/repak_cli/src/main.rs @@ -177,7 +177,7 @@ fn main() -> Result<(), repak::Error> { fn info(aes_key: Option, action: ActionInfo) -> Result<(), repak::Error> { let mut builder = repak::PakBuilder::new(); if let Some(aes_key) = aes_key { - builder.key(aes_key); + builder = builder.key(aes_key); } let pak = builder.reader(&mut BufReader::new(File::open(action.input)?))?; println!("mount point: {}", pak.mount_point()); @@ -192,7 +192,7 @@ fn info(aes_key: Option, action: ActionInfo) -> Result<(), repak::E fn list(aes_key: Option, action: ActionList) -> Result<(), repak::Error> { let mut builder = repak::PakBuilder::new(); if let Some(aes_key) = aes_key { - builder.key(aes_key); + builder = builder.key(aes_key); } let pak = builder.reader(&mut BufReader::new(File::open(action.input)?))?; @@ -225,7 +225,7 @@ fn list(aes_key: Option, action: ActionList) -> Result<(), repak::E fn hash_list(aes_key: Option, action: ActionHashList) -> Result<(), repak::Error> { let mut builder = repak::PakBuilder::new(); if let Some(aes_key) = aes_key { - builder.key(aes_key); + builder = builder.key(aes_key); } let pak = builder.reader(&mut BufReader::new(File::open(&action.input)?))?; @@ -284,9 +284,11 @@ fn unpack(aes_key: Option, action: ActionUnpack) -> Result<(), repa for input in &action.input { let mut builder = repak::PakBuilder::new(); #[cfg(windows)] - builder.oodle(get_oodle::decompress); + { + builder = builder.oodle(get_oodle::decompress); + } if let Some(aes_key) = aes_key.clone() { - builder.key(aes_key); + builder = builder.key(aes_key); } let pak = builder.reader(&mut BufReader::new(File::open(input)?))?; let output = action @@ -457,9 +459,11 @@ fn get(aes_key: Option, args: ActionGet) -> Result<(), repak::Error let mut reader = BufReader::new(File::open(&args.input)?); let mut builder = repak::PakBuilder::new(); #[cfg(windows)] - builder.oodle(get_oodle::decompress); + { + builder = builder.oodle(get_oodle::decompress); + } if let Some(aes_key) = aes_key { - builder.key(aes_key); + builder = builder.key(aes_key); } let pak = builder.reader(&mut reader)?; let mount_point = PathBuf::from(pak.mount_point());