on master help sign in
Use shouldIgnoreFile
7677bb4Simonas Kazlauskas
src/Hakyll/Preview/Poll.hs+6−8
@@ -21,21 +21,19 @@ import Hakyll.Core.Configuration
21previewPoll :: Configuration -- ^ Configuration
21previewPoll :: Configuration -- ^ Configuration
22 -> IO [FilePath] -- ^ Updating action
22 -> IO [FilePath] -- ^ Updating action
23 -> IO () -- ^ Can block forever
23 -> IO () -- ^ Can block forever
24+previewPoll conf update = do
25+ _ <- update
24−previewPoll conf update = monitor =<< startManagerConf (Debounce 0.1)
26+ manager <- startManagerConf (Debounce 0.1)
27+ ignore <- mapM getPath [destinationDirectory, storeDirectory, tmpDirectory]
28+ watchTree manager path (predicate ignore) (\_ -> void update)
25 where
29 where
26 path = decodeString $ providerDirectory conf
30 path = decodeString $ providerDirectory conf
27− monitor manager = do
28− _ <- update
29− ignore <- mapM getPath
30− [destinationDirectory, storeDirectory, tmpDirectory]
31− watchTree manager path (predicate ignore) (\_ -> void update)
32 getPath fn = catchIOError (canonicalizePath $ fn conf)
31 getPath fn = catchIOError (canonicalizePath $ fn conf)
33 (const $ return $ fn conf)
32 (const $ return $ fn conf)
34 predicate ignore evt
33 predicate ignore evt
35 | isRemove evt = False
34 | isRemove evt = False
36 | any (flip isPrefixOf $ eventPath evt) ignore == True = False
35 | any (flip isPrefixOf $ eventPath evt) ignore == True = False
37− | (ignoreFile conf) (eventPath evt) == True = False
36+ | otherwise = not $ shouldIgnoreFile conf (eventPath evt)
38− | otherwise = True
39
37
40eventPath :: Event -> FilePath
38eventPath :: Event -> FilePath
41eventPath (Added p _) = encodeString p
39eventPath (Added p _) = encodeString p