From 0f03160e178bfaab2cc3ad839ad681af224cbc5c Mon Sep 17 00:00:00 2001 From: Valerie Date: Wed, 16 Jun 2021 19:52:34 -0400 Subject: [PATCH] fixed a bug where local configurations would never be used if the CWD had a .open file --- src/config.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index 2dd1c5c..8d18a87 100644 --- a/src/config.rs +++ b/src/config.rs @@ -33,19 +33,20 @@ impl Config { let mut path_local = i_path_local.as_path(); let root = Path::new("/"); let mut local: Option = None; - while !path_local.exists() { + loop { if dir_local == root { 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() { let i_local = read_to_string(path_local).unwrap(); let mut tmp = Ini::new(); tmp.read(i_local).ok(); 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() {