Name the searchpath variable properly

This commit is contained in:
Matthias Beyer 2017-08-27 14:12:56 +02:00
parent 9193d50f96
commit 47ce383715

View file

@ -71,8 +71,8 @@ impl Configuration {
/// with all variants. /// with all variants.
/// ///
/// If that doesn't work either, an error is returned. /// If that doesn't work either, an error is returned.
pub fn new(rtp: &PathBuf) -> Result<Configuration> { pub fn new(config_searchpath: &PathBuf) -> Result<Configuration> {
fetch_config(&rtp).map(|cfg| { fetch_config(&config_searchpath).map(|cfg| {
let verbosity = get_verbosity(&cfg); let verbosity = get_verbosity(&cfg);
let editor = get_editor(&cfg); let editor = get_editor(&cfg);
let editor_opts = get_editor_opts(&cfg); let editor_opts = get_editor_opts(&cfg);
@ -224,7 +224,7 @@ fn get_editor_opts(v: &Value) -> String {
/// Helper to fetch the config file /// Helper to fetch the config file
/// ///
/// Tests several variants for the config file path and uses the first one which works. /// Tests several variants for the config file path and uses the first one which works.
fn fetch_config(rtp: &PathBuf) -> Result<Value> { fn fetch_config(searchpath: &PathBuf) -> Result<Value> {
use std::env; use std::env;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
@ -245,8 +245,8 @@ fn fetch_config(rtp: &PathBuf) -> Result<Value> {
}; };
vec![ vec![
vec![rtp.clone()], vec![searchpath.clone()],
gen_vars(rtp.clone(), variants.clone(), &modifier), gen_vars(searchpath.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))
.unwrap_or(vec![]), .unwrap_or(vec![]),