mirror of
https://github.com/orhun/systeroid
synced 2024-09-30 04:33:31 +00:00
refactor(config): simplify config path finding (#145)
I just found that this could be written with less code, so that's what I did here. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
76e2224115
commit
46240e4a9c
|
@ -108,14 +108,7 @@ impl Config {
|
|||
if path.is_some() {
|
||||
config_paths.insert(0, path);
|
||||
}
|
||||
let mut config_path = None;
|
||||
for path in config_paths.into_iter().flatten() {
|
||||
if path.exists() {
|
||||
config_path = Some(path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if let Some(path) = config_path {
|
||||
if let Some(path) = config_paths.into_iter().flatten().find(|p| p.exists()) {
|
||||
log::trace!(target: "config", "Parsing configuration from {:?}", path);
|
||||
let ini = Ini::load_from_file(path)?;
|
||||
if let Some(general_section) = ini.section(Some("general")) {
|
||||
|
|
Loading…
Reference in a new issue