diff options
author | Simonas Kazlauskas <git@kazlauskas.me> | 2013-04-03 13:31:27 +0300 |
---|---|---|
committer | Simonas Kazlauskas <git@kazlauskas.me> | 2013-04-03 13:31:27 +0300 |
commit | 5a9a869e5878f82df486859bcb36bd50b309c290 (patch) | |
tree | f3052d2d904bae8ff4ba9f277280908a1545e57c /src/Hakyll | |
parent | b5e34c64a78c687fa8c0fef6c4afb2fd77cc2414 (diff) | |
download | hakyll-5a9a869e5878f82df486859bcb36bd50b309c290.tar.gz |
Update patch for 5e4adaecb
Diffstat (limited to 'src/Hakyll')
-rw-r--r-- | src/Hakyll/Preview/Poll.hs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/Hakyll/Preview/Poll.hs b/src/Hakyll/Preview/Poll.hs index 65021db..36b057e 100644 --- a/src/Hakyll/Preview/Poll.hs +++ b/src/Hakyll/Preview/Poll.hs @@ -4,8 +4,6 @@ module Hakyll.Preview.Poll -------------------------------------------------------------------------------- import Filesystem.Path.CurrentOS (decodeString, encodeString) -import System.Directory (getCurrentDirectory) -import System.FilePath (makeRelative) import System.FSNotify (startManagerConf, watchTree, Event(..), WatchConfig(..)) @@ -21,17 +19,16 @@ watchUpdates :: Configuration -> IO () -> IO () watchUpdates conf update = do _ <- update manager <- startManagerConf (Debounce 0.1) - workingDirectory <- getCurrentDirectory - watchTree manager path (predicate workingDirectory) $ const update + watchTree manager path (not . isRemove) update' where path = decodeString $ providerDirectory conf - predicate wDir evt - | isRemove evt = False - | otherwise = not $ shouldIgnoreFile conf (relativeEventPath wDir evt) + update' evt = do + ignore <- shouldIgnoreFile conf $ eventPath evt + if ignore then return () else update -relativeEventPath :: FilePath -> Event -> FilePath -relativeEventPath b evt = makeRelative b $ encodeString $ evtPath evt +eventPath :: Event -> FilePath +eventPath evt = encodeString $ evtPath evt where evtPath (Added p _) = p evtPath (Modified p _) = p |