summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-17 17:15:56 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-17 17:15:56 -0400
commit91567ab8f6fae75d1590bfd05567e84157887c4b (patch)
tree07e31acc9b6c97f2e20f78ec70b47cb07c8729f3 /Assistant
parentbf3339e5b7c26cd24acefdf7c33059433195e1f6 (diff)
make inotify a build flag etc
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Watcher.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/Assistant/Watcher.hs b/Assistant/Watcher.hs
index 5af39ea88..1d35b5c1e 100644
--- a/Assistant/Watcher.hs
+++ b/Assistant/Watcher.hs
@@ -29,7 +29,7 @@ import Control.Concurrent.STM
import Data.Bits.Utils
import qualified Data.ByteString.Lazy as L
-#if defined linux_HOST_OS
+#ifdef WITH_INOTIFY
import Utility.Inotify
import System.INotify
#endif
@@ -38,11 +38,14 @@ type Handler = FilePath -> Maybe FileStatus -> DaemonStatusHandle -> Annex (Mayb
checkCanWatch :: Annex ()
checkCanWatch = do
-#if defined linux_HOST_OS
+#ifdef WITH_INOTIFY
unlessM (liftIO (inPath "lsof") <||> Annex.getState Annex.force) $
needLsof
#else
- error "watch mode is currently only available in Linux"
+#if defined linux_HOST_OS
+#warning "Building without inotify support; watch mode will be disabled."
+#endif
+ error "watch mode is not available on this system"
#endif
needLsof :: Annex ()
@@ -54,7 +57,7 @@ needLsof = error $ unlines
]
watchThread :: ThreadState -> DaemonStatusHandle -> ChangeChan -> IO ()
-#if defined linux_HOST_OS
+#ifdef WITH_INOTIFY
watchThread st dstatus changechan = withINotify $ \i -> do
runThreadState st $
showAction "scanning"