From e9de97e4daa7cfa8c945239e0848b448fdc6bada Mon Sep 17 00:00:00 2001 From: Zastian Pretorius Date: Wed, 26 Oct 2022 22:15:05 +0100 Subject: [PATCH] fixed config dir problem --- src/anime/trackers.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/anime/trackers.rs b/src/anime/trackers.rs index a1bb5be..68b779d 100644 --- a/src/anime/trackers.rs +++ b/src/anime/trackers.rs @@ -13,17 +13,14 @@ pub fn get_token() -> String { if !token_path.exists() { //create empty file fs::File::create(&token_path).unwrap(); - } else { - //read token from file - let token = fs::read_to_string(&token_path).unwrap(); - if token.is_empty() { - println!("please go to the below link and copy and past the token below"); - println!( - "https://anilist.co/api/v2/oauth/authorize?client_id=9121&response_type=token" - ); - let token = string_input("token: "); - fs::write(&token_path, token).unwrap(); - } + } + //read token from file + let token = fs::read_to_string(&token_path).unwrap(); + if token.is_empty() { + println!("please go to the below link and copy and past the token below"); + println!("https://anilist.co/api/v2/oauth/authorize?client_id=9121&response_type=token"); + let token = string_input("token: "); + fs::write(&token_path, token).unwrap(); } let token = fs::read_to_string(&token_path).unwrap(); token