summaryrefslogtreecommitdiff
path: root/src/Hakyll/Preview
diff options
context:
space:
mode:
authorSimonas Kazlauskas <git@kazlauskas.me>2013-03-30 18:07:16 +0200
committerSimonas Kazlauskas <git@kazlauskas.me>2013-03-30 18:07:16 +0200
commit7677bb4a775f7e0f6d1d88a5c0d37d5eb30d0213 (patch)
treeaa9a95b9d584155d041a132d4adc83c34358d2ed /src/Hakyll/Preview
parentfdfbf3dd344318dbb4f104644c6b952e48df294c (diff)
downloadhakyll-7677bb4a775f7e0f6d1d88a5c0d37d5eb30d0213.tar.gz
Use shouldIgnoreFile
Diffstat (limited to 'src/Hakyll/Preview')
-rw-r--r--src/Hakyll/Preview/Poll.hs14
1 files changed, 6 insertions, 8 deletions
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