aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/config.rs b/src/config.rs
index 9473784..020e1e2 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -229,15 +229,17 @@ pub fn setup_file_watch(config_path: PathBuf, state: Arc<State>) {
for event in events {
if event.mask.contains(EventMask::MODIFY) {
- if config_path.metadata().map(|m| m.len()).unwrap_or_default() == 0 {
- continue;
- }
- match Config::load(&config_path) {
- Ok(conf) => {
- let mut r = state.config.blocking_write();
- *r = Arc::new(conf)
+ if event.name == config_path.file_name() {
+ if config_path.metadata().map(|m| m.len()).unwrap_or_default() == 0 {
+ continue;
+ }
+ match Config::load(&config_path) {
+ Ok(conf) => {
+ let mut r = state.config.blocking_write();
+ *r = Arc::new(conf)
+ }
+ Err(e) => error!("config has errors: {e:?}"),
}
- Err(e) => error!("config has errors: {e:?}"),
}
}
}