1
0
mirror of https://github.com/pcvolkmer/osc-variant.git synced 2025-12-16 07:33:20 +00:00

Add optional destination dir for OSB file extraction

This commit is contained in:
2023-11-02 20:56:46 +01:00
parent f851e9c424
commit 1f5ec80cc6
3 changed files with 18 additions and 7 deletions

View File

@@ -24,6 +24,7 @@
use console::style;
use deob::deobfuscate;
use std::path::Path;
use std::{fs, io};
macro_rules! started {
@@ -48,7 +49,7 @@ macro_rules! error {
};
}
pub fn unzip_osb_using_password(path: &str, password: &str) {
pub fn unzip_osb_using_password(path: &str, dir: &str, password: &str) {
println!("Entpacke OSB-Datei {}\n", style(path).yellow());
let file = match fs::File::open(path) {
@@ -87,7 +88,7 @@ pub fn unzip_osb_using_password(path: &str, password: &str) {
};
let outpath = match file.enclosed_name() {
Some(path) => path.to_owned(),
Some(path) => Path::new(dir).join(path.to_owned()),
None => continue,
};
@@ -129,6 +130,6 @@ pub fn unzip_osb_using_password(path: &str, password: &str) {
}
}
pub fn unzip_osb(path: &str) {
unzip_osb_using_password(path, deobfuscate(env!("OSB_KEY").trim()).as_str());
pub fn unzip_osb(path: &str, dir: &str) {
unzip_osb_using_password(path, dir, deobfuscate(env!("OSB_KEY").trim()).as_str());
}