Skip to content

Commit

Permalink
Bug fix: prepend app path to torchbear.scl
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-zam committed Jan 12, 2019
1 parent 96d26ed commit 9b5d825
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,12 @@ impl ApplicationBuilder {
None => ()
}

if let Some(path) = init_path.clone() {
std::env::set_current_dir(path.parent().unwrap_or(Path::new(".")))?;
}
let scl_path = match &init_path {
Some(p) => p.parent().unwrap_or(Path::new(".")).join("torchbear.scl"),
None => PathBuf::from("torchbear.scl"),
};

let setting_file = Path::new("torchbear.scl");
let setting_file = scl_path.as_path();

let config = if setting_file.exists() {
conf::Conf::load_file(&setting_file)?
Expand Down

0 comments on commit 9b5d825

Please sign in to comment.