on master help sign in
Added in environment variable and the result is a file check in config.rs
commit20ba84d1fac834c7402af1187204b7620a39b645 authorRicky <Ricky@Hosfelt.io> dateThu 25 Oct 2018, 17:50 (8 years ago) parente81f9b2
1 file changed+12−1
src/config.rs+12−1
src/config.rs+12−1
@@ -9,7 +9,18 @@ use dirs::PROJECT_DIRS;
99use util::transpose;
1010
1111pub fn config_file() -> PathBuf {
12− PROJECT_DIRS.config_dir().join("config")
12+ match env::var("BAT_CONFIG_PATH") {
13+ Ok(env_path) => {
14+ let env_path_buf = PathBuf::from(env_path);
15+ if env_path_buf.is_file() {
16+ return env_path_buf;
17+ }
18+ else {
19+ return PROJECT_DIRS.config_dir().join("config");
20+ }
21+ }
22+ Err(_) => PROJECT_DIRS.config_dir().join("config"),
23+ }
1324}
1425
1526pub fn get_args_from_config_file() -> Result<Vec<OsString>, shell_words::ParseError> {