Bugfix for moved history.toml
This commit is contained in:
parent
9c15ea791f
commit
0f1de67db6
3 changed files with 8 additions and 5 deletions
|
@ -49,6 +49,9 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>) {
|
||||||
write.start = Utc::now();
|
write.start = Utc::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let info_msg = "Bot init successful, starting normal operations".to_owned();
|
||||||
|
write_info(info_msg);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
idle(&data).await;
|
idle(&data).await;
|
||||||
|
|
||||||
|
|
|
@ -46,14 +46,14 @@ pub(crate) async fn login(config: &Config) -> Result<Lemmy, ()> {
|
||||||
None => {
|
None => {
|
||||||
let err_msg = "Login did not return JWT token. Are the credentials valid?".to_owned();
|
let err_msg = "Login did not return JWT token. Are the credentials valid?".to_owned();
|
||||||
write_error(err_msg);
|
write_error(err_msg);
|
||||||
return Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
status => {
|
status => {
|
||||||
let err_msg = format!("Unexpected HTTP Status '{}' during Login", status);
|
let err_msg = format!("Unexpected HTTP Status '{}' during Login", status);
|
||||||
write_error(err_msg);
|
write_error(err_msg);
|
||||||
return Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@ impl SeriesHistory {
|
||||||
let config_dir = path.parent().expect("Something went wrong with confy");
|
let config_dir = path.parent().expect("Something went wrong with confy");
|
||||||
|
|
||||||
|
|
||||||
|
let path = format!("{}/history.toml", config_dir.to_str().expect("Conversion to str should not fail for a dir"));
|
||||||
match Path::new(format!("{}/history.toml", config_dir.to_str().expect("Conversion to str should not fail for a dir")).as_str()).exists() {
|
match Path::new(path.as_str()).exists() {
|
||||||
true => {
|
true => {
|
||||||
let file_contents: String = match fs::read_to_string("history.toml") {
|
let file_contents: String = match fs::read_to_string(path.as_str()) {
|
||||||
Ok(data) => data,
|
Ok(data) => data,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let err_msg = format!("{e}");
|
let err_msg = format!("{e}");
|
||||||
|
|
Loading…
Reference in a new issue