From 1d68b399d6f283f1560e3db0da570b5a00c1b38a Mon Sep 17 00:00:00 2001
From: Bill Welliver <bill@welliver.org>
Date: Sat, 1 Mar 2014 08:16:39 +0100
Subject: [PATCH] Filesystem.Monitor: generate data change events properly when
 using FSEvents.

---
 .../Filesystem.pmod/Monitor.pmod/basic.pike     | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike b/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike
index 9b937f2adf..92b0a5f8a4 100644
--- a/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike
+++ b/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike
@@ -754,6 +754,23 @@ protected class Monitor(string path,
       update(st);
       return 1;
     }
+#ifdef HAVE_EVENTSTREAM
+    else if(orig_flags & MF_RECURSE)
+    {
+      // if using FSEvents, we won't receive the name of the file changed, 
+      // so we have to scan for it. 
+      int caught;
+      array(string) files = get_dir(path) || ({});
+      this_program::files = files;
+      foreach(files, string file) {
+        file = canonic_path(Stdio.append_path(path, file));
+ 	if (monitors[file]) {
+          if(check_monitor(monitors[file])) caught = 1;
+        } 
+      }
+      return caught;
+    }
+#endif /* HAVE_EVENTSTREAM */
     return 0;
   }
 }
-- 
GitLab