aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Victor C <victorchiriac720@gmail.com> 2022-04-15 08:47:55 +0000
committerGravatar GitHub <noreply@github.com> 2022-04-15 16:47:55 +0800
commit8665e6a2cfb57ddfc4b0f5a8cf116b3a69d06521 (patch)
tree67f609a16143948f41593a08d520be0ecdaf766a
parent8a247238954722d4de7e83dba0cff410d62ffb14 (diff)
downloadrathole-8665e6a2cfb57ddfc4b0f5a8cf116b3a69d06521.tar.gz
rathole-8665e6a2cfb57ddfc4b0f5a8cf116b3a69d06521.tar.zst
rathole-8665e6a2cfb57ddfc4b0f5a8cf116b3a69d06521.zip
fix: make watcher's path absolute for notify's MacOS fsevent implementation (#155)
-rw-r--r--src/config_watcher.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/config_watcher.rs b/src/config_watcher.rs
index 00594c7..f80ac2c 100644
--- a/src/config_watcher.rs
+++ b/src/config_watcher.rs
@@ -5,6 +5,7 @@ use crate::{
use anyhow::{Context, Result};
use std::{
collections::HashMap,
+ env,
path::{Path, PathBuf},
};
use tokio::sync::{broadcast, mpsc};
@@ -139,6 +140,11 @@ async fn config_watcher(
mut old: Config,
) -> Result<()> {
let (fevent_tx, mut fevent_rx) = mpsc::unbounded_channel();
+ let path = if path.is_absolute() {
+ path
+ } else {
+ env::current_dir()?.join(path)
+ };
let parent_path = path.parent().expect("config file should have a parent dir");
let path_clone = path.clone();
let mut watcher =