on master help sign in
Update patch for 5e4adaecb
5a9a869Simonas Kazlauskas
src/Hakyll/Preview/Poll.hs+6−9
@@ -4,8 +4,6 @@ module Hakyll.Preview.Poll
4
4
5--------------------------------------------------------------------------------
5--------------------------------------------------------------------------------
6import Filesystem.Path.CurrentOS (decodeString, encodeString)
6import Filesystem.Path.CurrentOS (decodeString, encodeString)
7−import System.Directory (getCurrentDirectory)
8−import System.FilePath (makeRelative)
9import System.FSNotify (startManagerConf, watchTree,
7import System.FSNotify (startManagerConf, watchTree,
10 Event(..), WatchConfig(..))
8 Event(..), WatchConfig(..))
11
9
@@ -21,17 +19,16 @@ watchUpdates :: Configuration -> IO () -> IO ()
21watchUpdates conf update = do
19watchUpdates conf update = do
22 _ <- update
20 _ <- update
23 manager <- startManagerConf (Debounce 0.1)
21 manager <- startManagerConf (Debounce 0.1)
24− workingDirectory <- getCurrentDirectory
25− watchTree manager path (predicate workingDirectory) $ const update
22+ watchTree manager path (not . isRemove) update'
26 where
23 where
27 path = decodeString $ providerDirectory conf
24 path = decodeString $ providerDirectory conf
28− predicate wDir evt
25+ update' evt = do
29− | isRemove evt = False
30− | otherwise = not $ shouldIgnoreFile conf (relativeEventPath wDir evt)
26+ ignore <- shouldIgnoreFile conf $ eventPath evt
27+ if ignore then return () else update
31
28
32
29
33−relativeEventPath :: FilePath -> Event -> FilePath
30+eventPath :: Event -> FilePath
34−relativeEventPath b evt = makeRelative b $ encodeString $ evtPath evt
31+eventPath evt = encodeString $ evtPath evt
35 where
32 where
36 evtPath (Added p _) = p
33 evtPath (Added p _) = p
37 evtPath (Modified p _) = p
34 evtPath (Modified p _) = p