summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll/File.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2009-12-18 19:38:25 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2009-12-18 19:38:25 +0100
commitef4c166a1c1c918f47ee46933beb02e3edb8569d (patch)
tree14f25b8a0c5698bac5416f67ec61a459758fe95f /src/Text/Hakyll/File.hs
parentc1d93ebabfc03cf68ffabc7c2957c2c8935e4bc4 (diff)
downloadhakyll-ef4c166a1c1c918f47ee46933beb02e3edb8569d.tar.gz
Changed to a more general directory command, and added css command.
Diffstat (limited to 'src/Text/Hakyll/File.hs')
-rw-r--r--src/Text/Hakyll/File.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Hakyll/File.hs b/src/Text/Hakyll/File.hs
index 07464ac..5bca261 100644
--- a/src/Text/Hakyll/File.hs
+++ b/src/Text/Hakyll/File.hs
@@ -6,7 +6,8 @@ module Text.Hakyll.File
toURL,
makeDirectories,
getRecursiveContents,
- isCacheValid
+ isCacheValid,
+ directory
) where
import System.Directory
@@ -46,6 +47,10 @@ getRecursiveContents topdir = do
return (concat paths)
where isProper = not . (== '.') . head
+-- | Perform an IO action on every file in a given directory.
+directory :: (FilePath -> IO ()) -> FilePath -> IO ()
+directory action dir = getRecursiveContents dir >>= mapM_ action
+
-- | Check is a cache file is still valid.
isCacheValid :: FilePath -> [FilePath] -> IO Bool
isCacheValid cache depends = doesFileExist cache >>= \exists ->