From 0af027b27eab84c44a8ff936e22a3b55486ec12d Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Thu, 12 Aug 2021 18:36:03 -0400 Subject: [PATCH] fix default maFiles path from args handling --- src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3cffa3b..5c87b2a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -117,7 +117,11 @@ fn main() { return; } - let mafiles_dir = get_mafiles_dir(matches.value_of("mafiles-path")); + let mafiles_dir = if matches.occurrences_of("mafiles-path") > 0 { + matches.value_of("mafiles-path").unwrap().into() + } else { + get_mafiles_dir() + }; info!("reading manifest from {}", mafiles_dir); let path = Path::new(&mafiles_dir).join("manifest.json"); let mut manifest: accountmanager::Manifest; @@ -677,11 +681,7 @@ fn demo_confirmation_menu() { println!("accept: {}, deny: {}", accept.len(), deny.len()); } -fn get_mafiles_dir(arg: Option<&str>) -> String { - if let Some(arg_path) = arg { - return arg_path.into(); - } - +fn get_mafiles_dir() -> String { let paths = vec![ Path::new(&dirs::config_dir().unwrap()).join("steamguard-cli/maFiles"), Path::new(&dirs::home_dir().unwrap()).join("maFiles"),