commit 429a7f516e2150606e2ecd4911e4cae0d22a128a parent 07c0ed6fe1f6e7a66713ba881ab23f0a7a84f10a Author: Stefan Koch <programming@stefan-koch.name> Date: Sun, 22 Sep 2019 16:24:32 +0200 fix path to config.toml Diffstat:
M | src/config.rs | | | 1 | - |
M | src/lib.rs | | | 10 | +++++++++- |
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/config.rs b/src/config.rs @@ -19,7 +19,6 @@ pub struct Email { } pub fn read_config(path: PathBuf) -> Config { - // TODO: Use path relative to binary, not to CWD match fs::read_to_string(path) { Ok(contents) => { toml::from_str(&contents).expect("Configuration invalid") diff --git a/src/lib.rs b/src/lib.rs @@ -40,8 +40,16 @@ fn cinderella_file(folder: &PathBuf) -> PathBuf { cinderella_file } +fn appconfig_file() -> PathBuf { + let mut application_path = env::current_exe().unwrap(); + application_path.pop(); + application_path.push("config.toml"); + + application_path +} + pub fn run(repo_ptr: &RepoPointer) { - let config = config::read_config(env::current_dir().unwrap()); + let config = config::read_config(appconfig_file()); let repo = vcs::GitSource { src: repo_ptr.repo_url.clone(),