diff --git a/toot/src/main.rs b/toot/src/main.rs index d7be1d6e..9f84982f 100644 --- a/toot/src/main.rs +++ b/toot/src/main.rs @@ -2,13 +2,19 @@ extern crate elefren; use std::env; use std::io; +use std::path::Path; use std::error::Error; use elefren::prelude::*; use elefren::helpers::toml; // requires `features = ["toml"]` fn main() -> Result<(), Box> { - let mastodon = if let Ok(data) = toml::from_file("mastodon-data.toml") { + let config_filename = if Path::new("mastodon-data.toml").exists() { + "mastodon-data.toml" + } else { + "~/.mastodon-data.toml" + }; + let mastodon = if let Ok(data) = toml::from_file(config_filename) { Mastodon::from(data) } else { register()?