diff options
Diffstat (limited to 'src/Hakyll/Core/Util/File.hs')
-rw-r--r-- | src/Hakyll/Core/Util/File.hs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Hakyll/Core/Util/File.hs b/src/Hakyll/Core/Util/File.hs index 6d6b5c2..0e34d7c 100644 --- a/src/Hakyll/Core/Util/File.hs +++ b/src/Hakyll/Core/Util/File.hs @@ -3,14 +3,16 @@ module Hakyll.Core.Util.File ( makeDirectories , getRecursiveContents + , removeDirectory ) where -------------------------------------------------------------------------------- import Control.Applicative ((<$>)) -import Control.Monad (forM) +import Control.Monad (forM, when) import System.Directory (createDirectoryIfMissing, - doesDirectoryExist, getDirectoryContents) + doesDirectoryExist, getDirectoryContents, + removeDirectoryRecursive) import System.FilePath (takeDirectory, (</>)) @@ -42,3 +44,10 @@ getRecursiveContents top = go "" else return [rel] return $ concat paths + + +-------------------------------------------------------------------------------- +removeDirectory :: FilePath -> IO () +removeDirectory fp = do + e <- doesDirectoryExist fp + when e $ removeDirectoryRecursive fp |