Remove old session_file references
This commit is contained in:
parent
38131a5e4d
commit
a97bfdc15c
13
src/main.rs
13
src/main.rs
@ -180,16 +180,11 @@ async fn on_room_message(event: OriginalSyncRoomMessageEvent, room: Room) -> any
|
|||||||
async fn main() -> anyhow::Result<()> {
|
async fn main() -> anyhow::Result<()> {
|
||||||
let args: Vec<String> = std::env::args().collect();
|
let args: Vec<String> = std::env::args().collect();
|
||||||
|
|
||||||
let data_dir = dirs::data_dir()
|
let (client, sync_token) = if SESSION_FILE.exists() {
|
||||||
.expect("no data_dir directory found")
|
matrix::restore_session(&SESSION_FILE).await?
|
||||||
.join("scam_police");
|
|
||||||
let session_file = data_dir.join("session");
|
|
||||||
|
|
||||||
let (client, sync_token) = if session_file.exists() {
|
|
||||||
matrix::restore_session(&session_file).await?
|
|
||||||
} else if args.len() > 1 {
|
} 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,
|
None,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
@ -202,7 +197,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
let (client, sync_settings) = match matrix::sync(client, sync_token).await {
|
let (client, sync_settings) = match matrix::sync(client, sync_token).await {
|
||||||
Ok(c) => c,
|
Ok(c) => c,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
std::fs::remove_dir_all(data_dir)?;
|
std::fs::remove_dir_all(DATA_DIR.to_owned())?;
|
||||||
anyhow::bail!("{e}");
|
anyhow::bail!("{e}");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user