@@ -4,8 +4,6 @@ module Hakyll.Preview.Poll
44
55--------------------------------------------------------------------------------
66import Filesystem.Path.CurrentOS (decodeString, encodeString)
7−import System.Directory (getCurrentDirectory)
8−import System.FilePath (makeRelative)
97import System.FSNotify (startManagerConf, watchTree,
108 Event(..), WatchConfig(..))
119
@@ -21,17 +19,16 @@ watchUpdates :: Configuration -> IO () -> IO ()
2119watchUpdates conf update = do
2220 _ <- update
2321 manager <- startManagerConf (Debounce 0.1)
24− workingDirectory <- getCurrentDirectory
25− watchTree manager path (predicate workingDirectory) $ const update
22+ watchTree manager path (not . isRemove) update'
2623 where
2724 path = decodeString $ providerDirectory conf
28− predicate wDir evt
29− | isRemove evt = False
30− | otherwise = not $ shouldIgnoreFile conf (relativeEventPath wDir evt)
25+ update' evt = do
26+ ignore <- shouldIgnoreFile conf $ eventPath evt
27+ if ignore then return () else update
3128
3229
33−relativeEventPath :: FilePath -> Event -> FilePath
34−relativeEventPath b evt = makeRelative b $ encodeString $ evtPath evt
30+eventPath :: Event -> FilePath
31+eventPath evt = encodeString $ evtPath evt
3532 where
3633 evtPath (Added p _) = p
3734 evtPath (Modified p _) = p