Move username and password to config file
This commit is contained in:
parent
654bc5c7f8
commit
8d75aaa4f7
6 changed files with 46 additions and 27 deletions
src/post_history
|
@ -12,7 +12,12 @@ pub(crate) struct SeriesHistory {
|
|||
|
||||
impl SeriesHistory {
|
||||
pub(crate) fn load_history() -> Result<Self, String> {
|
||||
match Path::new("history.toml").exists() {
|
||||
let path = confy::get_configuration_file_path(env!("CARGO_PKG_NAME"), "config").expect("Something went wrong with confy");
|
||||
let config_dir = path.parent().expect("Something went wrong with confy");
|
||||
|
||||
|
||||
|
||||
match Path::new(format!("{}/history.toml", config_dir.to_str().expect("Conversion to str should not fail for a dir")).as_str()).exists() {
|
||||
true => {
|
||||
let file_contents: String = match fs::read_to_string("history.toml") {
|
||||
Ok(data) => data,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue