From a97bfdc15cb1c555bdc3d913b56c74596301fcf1 Mon Sep 17 00:00:00 2001 From: 0xf8 <0xf8.dev@proton.me> Date: Sun, 16 Apr 2023 23:11:07 -0400 Subject: [PATCH] Remove old session_file references --- src/main.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9fd3284..cce81e9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -180,16 +180,11 @@ async fn on_room_message(event: OriginalSyncRoomMessageEvent, room: Room) -> any async fn main() -> anyhow::Result<()> { let args: Vec = std::env::args().collect(); - let data_dir = dirs::data_dir() - .expect("no data_dir directory found") - .join("scam_police"); - let session_file = data_dir.join("session"); - - let (client, sync_token) = if session_file.exists() { - matrix::restore_session(&session_file).await? + let (client, sync_token) = if SESSION_FILE.exists() { + matrix::restore_session(&SESSION_FILE).await? } else if args.len() > 1 { ( - matrix::login(&data_dir, &session_file, args.get(1).unwrap().to_owned()).await?, + matrix::login(&DATA_DIR, &SESSION_FILE, args.get(1).unwrap().to_owned()).await?, None, ) } else { @@ -202,7 +197,7 @@ async fn main() -> anyhow::Result<()> { let (client, sync_settings) = match matrix::sync(client, sync_token).await { Ok(c) => c, Err(e) => { - std::fs::remove_dir_all(data_dir)?; + std::fs::remove_dir_all(DATA_DIR.to_owned())?; anyhow::bail!("{e}"); } };