summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/Core')
-rw-r--r--src/Hakyll/Core/Configuration.hs13
-rw-r--r--src/Hakyll/Core/Resource/Provider/File.hs2
2 files changed, 14 insertions, 1 deletions
diff --git a/src/Hakyll/Core/Configuration.hs b/src/Hakyll/Core/Configuration.hs
index 242b68f..985f5ae 100644
--- a/src/Hakyll/Core/Configuration.hs
+++ b/src/Hakyll/Core/Configuration.hs
@@ -2,6 +2,7 @@
--
module Hakyll.Core.Configuration
( HakyllConfiguration (..)
+ , shouldIgnoreFile
, defaultHakyllConfiguration
) where
@@ -23,6 +24,10 @@ data HakyllConfiguration = HakyllConfiguration
--
-- * files ending with @.swp@
--
+ -- Note that the files in @destinationDirectory@ and @storeDirectory@ will
+ -- also be ignored. Note that this is the configuration parameter, if you
+ -- want to use the test, you should use @shouldIgnoreFile@.
+ --
ignoreFile :: FilePath -> Bool
}
@@ -42,3 +47,11 @@ defaultHakyllConfiguration = HakyllConfiguration
| otherwise = False
where
fileName = takeFileName path
+
+-- | Check if a file should be ignored
+--
+shouldIgnoreFile :: HakyllConfiguration -> FilePath -> Bool
+shouldIgnoreFile conf path =
+ destinationDirectory conf `isPrefixOf` path ||
+ storeDirectory conf `isPrefixOf` path ||
+ ignoreFile conf path
diff --git a/src/Hakyll/Core/Resource/Provider/File.hs b/src/Hakyll/Core/Resource/Provider/File.hs
index 8365a5d..c0e306a 100644
--- a/src/Hakyll/Core/Resource/Provider/File.hs
+++ b/src/Hakyll/Core/Resource/Provider/File.hs
@@ -18,7 +18,7 @@ import Hakyll.Core.Configuration
fileResourceProvider :: HakyllConfiguration -> IO ResourceProvider
fileResourceProvider configuration = do
-- Retrieve a list of paths
- list <- map Resource . filter (not . ignoreFile configuration) <$>
+ list <- map Resource . filter (not . shouldIgnoreFile configuration) <$>
getRecursiveContents False "."
makeResourceProvider list (readFile . unResource)
(LB.readFile . unResource)