From b7ec4da44053c118dd3b0339a5ebd5484f75195d Mon Sep 17 00:00:00 2001 From: Toby Date: Wed, 10 May 2023 23:21:58 +0200 Subject: [PATCH] improvements --- src/config.rs | 5 +++-- src/main.rs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/config.rs b/src/config.rs index 1173e26..b4d5fbf 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, fs, path::Path}; +use std::{collections::HashMap, fs}; use serde::{Serialize, Deserialize}; @@ -23,7 +23,8 @@ pub struct Host { } pub fn read() -> Result { - let yaml = fs::read_to_string(Path::new("config.yaml")).unwrap_or("".to_string()); + let path = format!("{}/config.yaml", env!("PWD")); + let yaml = fs::read_to_string(path).unwrap_or("".to_string()); let config: Config = match serde_yaml::from_str(&yaml) { Ok(c) => c, Err(_) => return Err(()) diff --git a/src/main.rs b/src/main.rs index 4d71a59..eb51a94 100644 --- a/src/main.rs +++ b/src/main.rs @@ -130,6 +130,6 @@ fn main() { } for handler in handles { - handler.join().unwrap(); + handler.join().unwrap_or(()); } }