From 7677bb4a775f7e0f6d1d88a5c0d37d5eb30d0213 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Sat, 30 Mar 2013 18:07:16 +0200 Subject: Use shouldIgnoreFile --- src/Hakyll/Preview/Poll.hs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/Hakyll/Preview') diff --git a/src/Hakyll/Preview/Poll.hs b/src/Hakyll/Preview/Poll.hs index e9920ad..ec53e85 100644 --- a/src/Hakyll/Preview/Poll.hs +++ b/src/Hakyll/Preview/Poll.hs @@ -21,21 +21,19 @@ import Hakyll.Core.Configuration previewPoll :: Configuration -- ^ Configuration -> IO [FilePath] -- ^ Updating action -> IO () -- ^ Can block forever -previewPoll conf update = monitor =<< startManagerConf (Debounce 0.1) +previewPoll conf update = do + _ <- update + manager <- startManagerConf (Debounce 0.1) + ignore <- mapM getPath [destinationDirectory, storeDirectory, tmpDirectory] + watchTree manager path (predicate ignore) (\_ -> void update) where path = decodeString $ providerDirectory conf - monitor manager = do - _ <- update - ignore <- mapM getPath - [destinationDirectory, storeDirectory, tmpDirectory] - watchTree manager path (predicate ignore) (\_ -> void update) getPath fn = catchIOError (canonicalizePath $ fn conf) (const $ return $ fn conf) predicate ignore evt | isRemove evt = False | any (flip isPrefixOf $ eventPath evt) ignore == True = False - | (ignoreFile conf) (eventPath evt) == True = False - | otherwise = True + | otherwise = not $ shouldIgnoreFile conf (eventPath evt) eventPath :: Event -> FilePath eventPath (Added p _) = encodeString p -- cgit v1.2.3