diff options
author | Joey Hess <joey@kitenet.net> | 2012-12-29 14:58:13 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-12-29 14:58:13 -0400 |
commit | cdb47af26e621d15ade0a488597d9a228d4d430e (patch) | |
tree | ab2161bdb79c16cea21a604e24fd4d2d973697b8 /Utility | |
parent | 992eb6d6931cfc2ca8da0fe2d25e58742ce8cd77 (diff) |
avoid double commits with inotify when direct mode file is created
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/FSEvents.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Utility/FSEvents.hs b/Utility/FSEvents.hs index 97431c159..af8c2fc2f 100644 --- a/Utility/FSEvents.hs +++ b/Utility/FSEvents.hs @@ -50,8 +50,13 @@ watchDir dir ignored hooks = do ) else maybe (runhook delHook Nothing) handleadd =<< getstatus (eventPath evt) + {- Add hooks are run when a file is modified for + - compatability with INotify, which calls the add + - hook when a file is closed, and so tends to call + - both add and modify for file modifications. -} when (hasflag eventFlagItemModified && not (hasflag eventFlagItemIsDir)) $ do ms <- getstatus $ eventPath evt + maybe noop handleadd ms runhook modifyHook ms where hasflag f = eventFlags evt .&. f /= 0 |