on master help sign in
Commented Text.Hakyll.Util.
commit3d21d02d65ae809e5a6c117272bc2418226220c9 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateThu 3 Dec 2009, 14:14 (17 years ago) parentb7e01c4
2 files changed+9−5
src/Text/Hakyll/Render.hs+2−2 src/Text/Hakyll/Util.hs+7−3
src/Text/Hakyll/Render.hs+2−2
@@ -33,12 +33,12 @@ renderAndWrite :: FilePath -> Page -> IO ()
3333renderAndWrite templatePath page = do
3434 rendered <- renderPage templatePath page
3535 let destination = toDestination $ getURL rendered
36− touchDirectories destination
36+ makeDirectories destination
3737 writeFile destination (getBody rendered)
3838
3939static :: FilePath -> IO ()
4040static source = do
41− touchDirectories destination
41+ makeDirectories destination
4242 copyFile source destination
4343 where destination = toDestination source
4444
src/Text/Hakyll/Util.hs+7−3
@@ -1,5 +1,5 @@
11module Text.Hakyll.Util
2− ( touchDirectories,
2+ ( makeDirectories,
33 getRecursiveContents
44 ) where
55
@@ -7,10 +7,14 @@ import System.Directory
77import System.FilePath
88import Control.Monad
99
10−touchDirectories :: FilePath -> IO ()
11−touchDirectories path = createDirectoryIfMissing True dir
10+-- | Given a path to a file, try to make the path writable by making
11+-- all directories on the path.
12+makeDirectories :: FilePath -> IO ()
13+makeDirectories path = createDirectoryIfMissing True dir
1214 where dir = takeDirectory path
1315
16+-- | Get all contents of a directory. Note that files starting with a dot (.)
17+-- will be ignored.
1418getRecursiveContents :: FilePath -> IO [FilePath]
1519getRecursiveContents topdir = do
1620 names <- getDirectoryContents topdir