on master help sign in
Fix issue with ignoreFile
86cdd03Jasper Van der Jeugt
src/Hakyll/Core/Configuration.hs+13
@@ -2,6 +2,7 @@
2--
2--
3module Hakyll.Core.Configuration
3module Hakyll.Core.Configuration
4 ( HakyllConfiguration (..)
4 ( HakyllConfiguration (..)
5+ , shouldIgnoreFile
5 , defaultHakyllConfiguration
6 , defaultHakyllConfiguration
6 ) where
7 ) where
7
8
@@ -23,6 +24,10 @@ data HakyllConfiguration = HakyllConfiguration
23 --
24 --
24 -- * files ending with @.swp@
25 -- * files ending with @.swp@
25 --
26 --
27+ -- Note that the files in @destinationDirectory@ and @storeDirectory@ will
28+ -- also be ignored. Note that this is the configuration parameter, if you
29+ -- want to use the test, you should use @shouldIgnoreFile@.
30+ --
26 ignoreFile :: FilePath -> Bool
31 ignoreFile :: FilePath -> Bool
27 }
32 }
28
33
@@ -42,3 +47,11 @@ defaultHakyllConfiguration = HakyllConfiguration
42 | otherwise = False
47 | otherwise = False
43 where
48 where
44 fileName = takeFileName path
49 fileName = takeFileName path
50+
51+-- | Check if a file should be ignored
52+--
53+shouldIgnoreFile :: HakyllConfiguration -> FilePath -> Bool
54+shouldIgnoreFile conf path =
55+ destinationDirectory conf `isPrefixOf` path ||
56+ storeDirectory conf `isPrefixOf` path ||
57+ ignoreFile conf path
src/Hakyll/Core/Resource/Provider/File.hs+1−1
@@ -18,7 +18,7 @@ import Hakyll.Core.Configuration
18fileResourceProvider :: HakyllConfiguration -> IO ResourceProvider
18fileResourceProvider :: HakyllConfiguration -> IO ResourceProvider
19fileResourceProvider configuration = do
19fileResourceProvider configuration = do
20 -- Retrieve a list of paths
20 -- Retrieve a list of paths
21− list <- map Resource . filter (not . ignoreFile configuration) <$>
21+ list <- map Resource . filter (not . shouldIgnoreFile configuration) <$>
22 getRecursiveContents False "."
22 getRecursiveContents False "."
23 makeResourceProvider list (readFile . unResource)
23 makeResourceProvider list (readFile . unResource)
24 (LB.readFile . unResource)
24 (LB.readFile . unResource)