diff options
| author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-05-16 23:09:06 +0200 |
|---|---|---|
| committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-05-16 23:12:51 +0200 |
| commit | 86cdd0327fc937997a407c1ccbd73bd107d7d38e (patch) | |
| tree | 8d2f30f65c832e4bb24a16662c04271dd5c86497 /src | |
| parent | 8c0335c726f02c9fceeed4bc0db11b63166bd1fb (diff) | |
| download | hakyll-86cdd0327fc937997a407c1ccbd73bd107d7d38e.tar.gz | |
Fix issue with ignoreFile
Diffstat (limited to 'src')
| -rw-r--r-- | src/Hakyll/Core/Configuration.hs | 13 | ||||
| -rw-r--r-- | src/Hakyll/Core/Resource/Provider/File.hs | 2 |
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) |
