factor out token path
This commit is contained in:
parent
015b422944
commit
96cb053e65
@ -21,13 +21,17 @@ struct Saved {
|
|||||||
errorcode: u64,
|
errorcode: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_token_path() -> String {
|
||||||
|
get_ipass_folder() + "token.ipasst"
|
||||||
|
}
|
||||||
|
|
||||||
fn get_token() -> Option<String> {
|
fn get_token() -> Option<String> {
|
||||||
let mut token: String = String::new();
|
let mut token: String = String::new();
|
||||||
//check if file exists
|
//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;
|
return None;
|
||||||
}
|
}
|
||||||
File::open(get_ipass_folder() + "token.ipasst")
|
File::open(get_token_path())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.read_to_string(&mut token)
|
.read_to_string(&mut token)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user