mirror of
https://github.com/pcvolkmer/osc-variant.git
synced 2025-04-19 11:46:50 +00:00
refactor: change usage of password dependent on feature selection
This commit is contained in:
parent
a70f72603f
commit
1215daca1e
@ -138,17 +138,18 @@ pub trait Fixable {
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
pub fn check_file(file: &Path, password: &Option<String>) -> Result<Vec<CheckNotice>, CheckNotice> {
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
pub fn check_file(file: &Path, password: Option<String>) -> Result<Vec<CheckNotice>, CheckNotice> {
|
||||
match file.extension() {
|
||||
Some(ex) => match ex.to_str() {
|
||||
#[cfg(feature = "unzip-osb")]
|
||||
Some("osb") => match password {
|
||||
Some(password) => osb::check_file(file, password.as_str()),
|
||||
None => {
|
||||
use deob::deobfuscate;
|
||||
osb::check_file(file, deobfuscate(env!("OSB_KEY").trim()).as_str())
|
||||
}
|
||||
},
|
||||
Some("osb") => {
|
||||
use deob::deobfuscate;
|
||||
osb::check_file(
|
||||
file,
|
||||
&password.unwrap_or_else(|| deobfuscate(env!("OSB_KEY").trim())),
|
||||
)
|
||||
}
|
||||
Some("osc") => osc::check_file(file),
|
||||
_ => Err(CheckNotice::Error {
|
||||
description: "Keine prüfbare Datei".to_string(),
|
||||
|
@ -289,7 +289,7 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
|
||||
if list {
|
||||
print();
|
||||
} else {
|
||||
match check_file(Path::new(file.unwrap_or_default().as_str()), &password) {
|
||||
match check_file(Path::new(file.unwrap_or_default().as_str()), password) {
|
||||
Ok(notices) => {
|
||||
println!(
|
||||
"Es wurden {} Probleme gefunden\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user