aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-11-11 16:53:13 -0800
committerJoe Wilm <joe@jwilm.com>2016-11-11 16:53:13 -0800
commit3e0b2b6c58ba3c93942056535b2c492bad5f1568 (patch)
tree96f1e7201aea0368222eeb1ebd38316527a6937d /src/config.rs
parentbe036edbdd764b596c81edf54827b376de4b3e3e (diff)
downloadalacritty-3e0b2b6c58ba3c93942056535b2c492bad5f1568.tar.gz
alacritty-3e0b2b6c58ba3c93942056535b2c492bad5f1568.zip
Fix config file reloading on macOS
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/config.rs b/src/config.rs
index cd6880d7..33474ddb 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -577,23 +577,29 @@ impl Watcher {
let ::notify::Event { path, op } = event;
if let Ok(op) = op {
- if op.contains(op::RENAME) {
+ // Skip events that are just a rename
+ if op.contains(op::RENAME) && !op.contains(op::WRITE) {
continue;
}
+ // Need to handle ignore for linux
if op.contains(op::IGNORED) {
if let Some(path) = path.as_ref() {
if let Err(err) = watcher.watch(&path) {
err_println!("failed to establish watch on {:?}: {:?}", path, err);
}
+ }
+ }
- if path == config_path {
- if let Ok((config, _)) = Config::load() {
- handler.on_config_reload(config);
- };
+ // Reload file
+ path.map(|path| {
+ if path == config_path {
+ match Config::load() {
+ Ok((config, _)) => handler.on_config_reload(config),
+ Err(err) => err_println!("Ignoring invalid config: {}", err),
}
}
- }
+ });
}
}
}))