@@ -8,11 +8,13 @@ module Hakyll.Core.Configuration
10--------------------------------------------------------------------------------
10--------------------------------------------------------------------------------
11−import Control.Monad (void)
11+import Control.Monad (void)
12−import Data.Default (Default(..))
12+import Data.Default (Default (..))
13−import Data.List (isPrefixOf, isSuffixOf)
13+import Data.List (isPrefixOf, isSuffixOf)
14+import System.Directory (canonicalizePath)
14−import System.FilePath (normalise, takeFileName)
15+import System.FilePath (isAbsolute, normalise, takeFileName)
16+import System.IO.Error (catchIOError)
15−import System.Process (system)
17+import System.Process (system)
18--------------------------------------------------------------------------------
20--------------------------------------------------------------------------------
@@ -99,11 +101,23 @@ defaultConfiguration = Configuration
100--------------------------------------------------------------------------------
102--------------------------------------------------------------------------------
101-- | Check if a file should be ignored
103-- | Check if a file should be ignored
102−shouldIgnoreFile :: Configuration -> FilePath -> Bool
104+shouldIgnoreFile :: Configuration -> FilePath -> IO Bool
103−shouldIgnoreFile conf path =
105+shouldIgnoreFile conf path = orM
104− destinationDirectory conf `isPrefixOf` path' ||
106+ [ inDir (destinationDirectory conf)
105− storeDirectory conf `isPrefixOf` path' ||
107+ , inDir (storeDirectory conf)
106− tmpDirectory conf `isPrefixOf` path' ||
108+ , inDir (tmpDirectory conf)
107− ignoreFile conf path'
109+ , return (ignoreFile conf path')
109− path' = normalise path
112+ path' = normalise path
113+ absolute = isAbsolute path
117+ dir' <- catchIOError (canonicalizePath dir) (const $ return dir)
118+ return $ dir' `isPrefixOf` path'
119+ | otherwise = return $ dir `isPrefixOf` path'
121+ orM :: [IO Bool] -> IO Bool
122+ orM [] = return False
123+ orM (x : xs) = x >>= \b -> if b then return True else orM xs