diff --git a/flake.nix b/flake.nix index 9d4eb51..b402dfe 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ }; packages.${system}.default = pkgs.rustPlatform.buildRustPackage { pname = "mbdirnotify"; - version = "0.4.3"; + version = "0.0.1"; cargoLock.lockFile = ./Cargo.lock; src = pkgs.lib.cleanSource ./.; }; diff --git a/src/main.rs b/src/main.rs index c5c3051..bfb0a58 100644 --- a/src/main.rs +++ b/src/main.rs @@ -48,8 +48,11 @@ fn watch(event: notify::Result) { fn parse_event(event: notify::Result) -> Result<()> { let event = event?; - if let EventKind::Create(_kind) = event.kind { + if let EventKind::Modify(_kind) = event.kind { if let Some(p) = event.paths.first() { + if !p.exists() { + return Ok(()); + } let mut f = File::open(&p)?; let mut buf = vec![]; f.read_to_end(&mut buf)?;