Skip to content

Commit

Permalink
fix(config): actually get config from executable directory, instead o…
Browse files Browse the repository at this point in the history
…f cwd
  • Loading branch information
ravenclaw900 committed Nov 27, 2021
1 parent 7cb9b72 commit 5965551
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/backend/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ pub struct Config {
}

pub fn config() -> Config {
let mut cfgpath = std::env::current_exe().unwrap();
cfgpath.set_file_name("config.toml");
let cfg = TomlParser::parse(
&match std::fs::read_to_string("config.toml") {
&match std::fs::read_to_string(cfgpath) {
Err(ref e) if e.kind() == std::io::ErrorKind::NotFound => {
std::fs::write("config.toml", "").unwrap();
String::new()
Expand Down

0 comments on commit 5965551

Please sign in to comment.