1
0
mirror of https://github.com/pcvolkmer/osc-variant.git synced 2025-04-19 11:46:50 +00:00

refactor: remove password-less wrapper function for OSB files

This commit is contained in:
Paul-Christian Volkmer 2025-01-01 18:50:47 +01:00
parent 8be859d274
commit f02a925e3f
2 changed files with 5 additions and 14 deletions

View File

@ -317,15 +317,8 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
password,
dir,
} => {
use crate::unzip_osb::{unzip_osb, unzip_osb_using_password};
match password {
Some(password) => unzip_osb_using_password(
file.as_str(),
dir.unwrap_or_default().as_str(),
password.as_str(),
),
None => unzip_osb(file.as_str(), dir.unwrap_or_default().as_str()),
}
use crate::unzip_osb::unzip_osb;
unzip_osb(file.as_str(), dir.unwrap_or_default().as_str(), password)
}
}

View File

@ -45,7 +45,9 @@ macro_rules! error {
};
}
pub fn unzip_osb_using_password(path: &str, dir: &str, password: &str) {
pub fn unzip_osb(path: &str, dir: &str, password: Option<String>) {
let password = password.unwrap_or_else(|| deobfuscate(env!("OSB_KEY").trim()));
println!("Entpacke OSB-Datei {}\n", style(path).yellow());
let file = match fs::File::open(path) {
@ -125,7 +127,3 @@ pub fn unzip_osb_using_password(path: &str, dir: &str, password: &str) {
}
}
}
pub fn unzip_osb(path: &str, dir: &str) {
unzip_osb_using_password(path, dir, deobfuscate(env!("OSB_KEY").trim()).as_str());
}