]> woffs.de Git - fd/haskell-amqp-utils.git/commitdiff
hinotify 0.3.10 compat
authorFrank Doepper <[email protected]>
Tue, 10 Jul 2018 14:27:18 +0000 (16:27 +0200)
committerFrank Doepper <[email protected]>
Tue, 10 Jul 2018 14:27:18 +0000 (16:27 +0200)
agitprop.hs
amqp-utils.cabal

index 480307a9e5bcd11df2e0cd62bff2a4cc5c9e9d0a..bd03adc1f07a4a3b0dd82be6501fec4ca603c1a6 100644 (file)
@@ -1,8 +1,12 @@
+{-# LANGUAGE CPP #-}
 -- generic AMQP publisher
 import Control.Concurrent (threadDelay)
 import qualified Control.Exception as X
 import Control.Monad (forever)
 import qualified Data.ByteString.Lazy.Char8 as BL
+#if MIN_VERSION_hinotify(0,3,10)
+import qualified Data.ByteString.Char8 as BS
+#endif
 import Data.List (isSuffixOf)
 import Data.Maybe
 import qualified Data.Text as T
@@ -51,7 +55,11 @@ main = do
            addWatch
              inotify
              [CloseWrite, MoveIn]
+#if MIN_VERSION_hinotify(0,3,10)
+             (BS.pack (inputFile args))
+#else
              (inputFile args)
+#endif
              (handleEvent publishOneMsg (suffix args) (inputFile args))
          hr $ "BEGIN watching " ++ (inputFile args)
          _ <- forever $ threadDelay 1000000
@@ -91,8 +99,13 @@ handleEvent ::
   -> Event
   -> IO ()
 -- just handle closewrite and movedin events
+#if MIN_VERSION_hinotify(0,3,10)
+handleEvent f s p (Closed False (Just x) True) = handleFile f s (p ++ "/" ++ (BS.unpack x))
+handleEvent f s p (MovedIn False x _) = handleFile f s (p ++ "/" ++ (BS.unpack x))
+#else
 handleEvent f s p (Closed False (Just x) True) = handleFile f s (p ++ "/" ++ x)
 handleEvent f s p (MovedIn False x _) = handleFile f s (p ++ "/" ++ x)
+#endif
 handleEvent _ _ _ _ = return ()
 
 -- | Hotfolder file handler
index a32fbbbded72813425c5798797efac0a8319e552..cc6c164d497897216f9f2f207adf246a27feece0 100644 (file)
@@ -68,7 +68,7 @@ executable agitprop
                        tls,
                        amqp >=0.17,
                        unix >= 2.7,
-                       hinotify >= 0.3.8 && < 0.3.10,
+                       hinotify >= 0.3.8,
                        magic
   
   ghc-options:         -threaded -Wall