Merge pull request #453 from matthiasbeyer/libimagrt/config-finding-fix

Libimagrt/config finding fix
This commit is contained in:
Matthias Beyer 2016-05-29 01:31:11 +02:00
commit 8c00723db4
2 changed files with 9 additions and 1 deletions

View file

@ -143,6 +143,7 @@ fn fetch_config(rtp: &PathBuf) -> Result<Value> {
}; };
vec![ vec![
vec![rtp.clone()],
gen_vars(rtp.clone(), variants.clone(), &modifier), gen_vars(rtp.clone(), variants.clone(), &modifier),
env::var("HOME").map(|home| gen_vars(PathBuf::from(home), variants.clone(), &modifier)) env::var("HOME").map(|home| gen_vars(PathBuf::from(home), variants.clone(), &modifier))

View file

@ -70,7 +70,14 @@ impl<'a> Runtime<'a> {
spath spath
}, PathBuf::from); }, PathBuf::from);
let cfg = match Configuration::new(&rtp) { let configpath = matches.value_of("config")
.map_or_else(|| {
let mut spath = rtp.clone();
spath.push("store");
spath
}, PathBuf::from);
let cfg = match Configuration::new(&configpath) {
Err(e) => if e.err_type() != ConfigErrorKind::NoConfigFileFound { Err(e) => if e.err_type() != ConfigErrorKind::NoConfigFileFound {
return Err(RuntimeErrorKind::Instantiate.into_error_with_cause(Box::new(e))); return Err(RuntimeErrorKind::Instantiate.into_error_with_cause(Box::new(e)));
} else { } else {