summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@oberon.tam-lin.net>2012-12-27 14:34:55 -0500
committerGravatar Joey Hess <joey@kitenet.net>2012-12-27 15:35:35 -0400
commit8f7f2976096db7ae873116f85da6445df9fe3ae6 (patch)
tree2513a1b2a75700fa97316c22d67baef0baf2cd76
parent4c6096e2f92db212c2172e5567e5eaa53629ab9a (diff)
fsevents bugfix for symlinks
-rw-r--r--Utility/FSEvents.hs14
1 files changed, 5 insertions, 9 deletions
diff --git a/Utility/FSEvents.hs b/Utility/FSEvents.hs
index 2f0ada955..8a8f890eb 100644
--- a/Utility/FSEvents.hs
+++ b/Utility/FSEvents.hs
@@ -21,7 +21,6 @@ watchDir dir ignored hooks = do
eventStreamCreate [dir] 1.0 True False True handle
where
handle evt
- | not (hasflag eventFlagItemIsFile) = noop
| ignoredPath ignored (eventPath evt) = noop
| otherwise = do
{- More than one flag may be set, if events occurred
@@ -34,15 +33,12 @@ watchDir dir ignored hooks = do
- the delHook will run first, followed by the addHook.
-}
- {- Deletion events are received for both directories
- - and files, with no way to differentiate between
- - them. Deleting a directory always first yields
- - events deleting its contents though, so we
- - just always call delHook, and never delDirHook. -}
when (hasflag eventFlagItemRemoved) $
- runhook delHook Nothing
+ if hasflag eventFlagItemIsDir
+ then runhook delDirHook Nothing
+ else runhook delHook Nothing
{- TODO deal with moving whole directories -}
- when (hasflag eventFlagItemCreated || hasflag eventFlagItemRenamed) $ do
+ when (hasflag eventFlagItemCreated || (hasflag eventFlagItemRenamed && not (hasflag eventFlagItemRemoved))) $ do
ms <- getstatus $ eventPath evt
case ms of
Nothing -> noop
@@ -52,7 +48,7 @@ watchDir dir ignored hooks = do
| Files.isRegularFile s ->
runhook addHook ms
| otherwise -> noop
- when (hasflag eventFlagItemModified) $ do
+ when (hasflag eventFlagItemModified && not (hasflag eventFlagItemIsDir)) $ do
ms <- getstatus $ eventPath evt
runhook modifyHook ms
where