module Drasil.Build.Artifacts.Directory (createDirIfMissing) where
import Control.Monad (unless)
import System.Directory (createDirectoryIfMissing, doesPathExist)
createDirIfMissing :: Bool -> FilePath -> IO ()
createDirIfMissing :: Bool -> FilePath -> IO ()
createDirIfMissing Bool
withParents FilePath
path = do
Bool
exists <- FilePath -> IO Bool
doesPathExist FilePath
path
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless Bool
exists (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> FilePath -> IO ()
createDirectoryIfMissing Bool
withParents FilePath
path