diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2009-12-02 13:49:42 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2009-12-02 13:49:42 +0100 |
commit | 36e4bf881b707948835bbae284ac444c80c67cc2 (patch) | |
tree | 07a1baf7b4db781c9dfd341213595dccfe8328e7 /src/Text/Hakyll/Util.hs | |
download | hakyll-36e4bf881b707948835bbae284ac444c80c67cc2.tar.gz |
Initial commit.
Diffstat (limited to 'src/Text/Hakyll/Util.hs')
-rw-r--r-- | src/Text/Hakyll/Util.hs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Text/Hakyll/Util.hs b/src/Text/Hakyll/Util.hs new file mode 100644 index 0000000..1b24d31 --- /dev/null +++ b/src/Text/Hakyll/Util.hs @@ -0,0 +1,21 @@ +module Text.Hakyll.Util where + +import System.Directory +import System.FilePath +import Control.Monad + +touchDirectories :: FilePath -> IO () +touchDirectories path = createDirectoryIfMissing True dir + where dir = takeDirectory path + +getRecursiveContents :: FilePath -> IO [FilePath] +getRecursiveContents topdir = do + names <- getDirectoryContents topdir + let properNames = filter (`notElem` [".", ".."]) names + paths <- forM properNames $ \name -> do + let path = topdir </> name + isDirectory <- doesDirectoryExist path + if isDirectory + then getRecursiveContents path + else return [path] + return (concat paths) |