diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2009-12-07 20:34:45 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2009-12-07 20:34:45 +0100 |
commit | 453e81f746c3a0e254457881cc0ac8609874cf32 (patch) | |
tree | 642446fc76fbbfcd7525a0cc6ecf752d54b5309b /src/Text/Hakyll/Util.hs | |
parent | 35e6572f6c30ffa9db61bb9ab71478cfb8d6aed1 (diff) | |
download | hakyll-453e81f746c3a0e254457881cc0ac8609874cf32.tar.gz |
Added basic dependency checking.
Diffstat (limited to 'src/Text/Hakyll/Util.hs')
-rw-r--r-- | src/Text/Hakyll/Util.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Text/Hakyll/Util.hs b/src/Text/Hakyll/Util.hs index 773e32c..1d79b4a 100644 --- a/src/Text/Hakyll/Util.hs +++ b/src/Text/Hakyll/Util.hs @@ -5,7 +5,7 @@ module Text.Hakyll.Util getRecursiveContents, trim, split, - isCacheFileValid + isCacheValid ) where import System.Directory @@ -56,8 +56,9 @@ split element = unfoldr splitOnce else Just (x, tail xs) -- | Check is a cache file is still valid. -isCacheFileValid :: FilePath -> FilePath -> IO Bool -isCacheFileValid cache file = doesFileExist cache >>= \exists -> +isCacheValid :: FilePath -> [FilePath] -> IO Bool +isCacheValid cache depends = doesFileExist cache >>= \exists -> if not exists then return False - else liftM2 (<=) (getModificationTime file) - (getModificationTime cache) + else do dependsModified <- (mapM getModificationTime depends) >>= return . maximum + cacheModified <- getModificationTime cache + return (cacheModified >= dependsModified) |