fixed a bug where local configurations would never be used if the CWD had a .open file

This commit is contained in:
Valerie Wolfe 2021-06-16 19:52:34 -04:00
parent f31fbab01c
commit 0f03160e17

View file

@ -33,19 +33,20 @@ impl Config {
let mut path_local = i_path_local.as_path(); let mut path_local = i_path_local.as_path();
let root = Path::new("/"); let root = Path::new("/");
let mut local: Option<Ini> = None; let mut local: Option<Ini> = None;
while !path_local.exists() { loop {
if dir_local == root { if dir_local == root {
break; break;
} }
dir_local = dir_local.parent().unwrap();
i_path_local = dir_local.join(".open");
path_local = i_path_local.as_path();
if path_local.exists() { if path_local.exists() {
let i_local = read_to_string(path_local).unwrap(); let i_local = read_to_string(path_local).unwrap();
let mut tmp = Ini::new(); let mut tmp = Ini::new();
tmp.read(i_local).ok(); tmp.read(i_local).ok();
local = Some(tmp); local = Some(tmp);
break;
} }
dir_local = dir_local.parent().unwrap();
i_path_local = dir_local.join(".open");
path_local = i_path_local.as_path();
} }
if global.is_none() && local.is_none() { if global.is_none() && local.is_none() {