From 96cb053e659123afc394187229949e7f32c23372 Mon Sep 17 00:00:00 2001 From: Code002Lover Date: Mon, 1 Jan 2024 19:00:11 +0100 Subject: [PATCH] factor out token path --- src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index dda17ba..6ca1400 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,13 +21,17 @@ struct Saved { errorcode: u64, } +pub fn get_token_path() -> String { + get_ipass_folder() + "token.ipasst" +} + fn get_token() -> Option { let mut token: String = String::new(); //check if file exists - if !std::path::Path::new(&(get_ipass_folder() + "token.ipasst")).exists() { + if !std::path::Path::new(&get_token_path()).exists() { return None; } - File::open(get_ipass_folder() + "token.ipasst") + File::open(get_token_path()) .unwrap() .read_to_string(&mut token) .unwrap();