summaryrefslogtreecommitdiff
path: root/Utility/Win32Notify.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-12 17:17:50 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-12 17:29:29 -0400
commitbb2e98c8f1b5b6e1eecf1c5f7ca5fa37b8c6f8a7 (patch)
treeb56b1be9dba41b44c1eb861fbb2ea39989e00f43 /Utility/Win32Notify.hs
parent6ca8426717af44744d184f4e605e965e840dd16f (diff)
use Win32-inotify
May mean the watcher works on Windows. Untested.
Diffstat (limited to 'Utility/Win32Notify.hs')
-rw-r--r--Utility/Win32Notify.hs15
1 files changed, 8 insertions, 7 deletions
diff --git a/Utility/Win32Notify.hs b/Utility/Win32Notify.hs
index 3493b9e9a..edde5309c 100644
--- a/Utility/Win32Notify.hs
+++ b/Utility/Win32Notify.hs
@@ -11,32 +11,33 @@ import Common hiding (isDirectory)
import Utility.DirWatcher.Types
import System.Win32.Notify
+import qualified System.PosixCompat.Files as Files
watchDir :: FilePath -> (FilePath -> Bool) -> WatchHooks -> IO WatchManager
watchDir dir ignored hooks = do
scan dir
wm <- initWatchManager
void $ watchDirectory wm dir True [Create, Delete, Modify, Move] handle
- retufn wm
+ return wm
where
handle evt
| ignoredPath ignored (filePath evt) = noop
- | otherwise = case eventToVariety evt of
- Delete
+ | otherwise = case evt of
+ (Deleted _ _)
| isDirectory evt -> runhook delDirHook Nothing
| otherwise -> runhook delHook Nothing
- Create
+ (Created _ _)
| isDirectory evt -> noop
| otherwise -> runhook addHook Nothing
- Modify
+ (Modified _ _)
| isDirectory evt -> noop
{- 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. -}
| otherwise -> do
- runHook addHook Nothing
- runHook modifyHook Nothing
+ runhook addHook Nothing
+ runhook modifyHook Nothing
where
runhook h s = maybe noop (\a -> a (filePath evt) s) (h hooks)