summaryrefslogtreecommitdiff
path: root/Propellor/Property/File.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Propellor/Property/File.hs')
-rw-r--r--Propellor/Property/File.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Propellor/Property/File.hs b/Propellor/Property/File.hs
index 02bf27c0..f3065d21 100644
--- a/Propellor/Property/File.hs
+++ b/Propellor/Property/File.hs
@@ -38,3 +38,8 @@ fileProperty desc a f = Property desc $ go =<< doesFileExist f
then noChange
else makeChange $ viaTmp writeFile f (unlines ls')
go False = makeChange $ writeFile f (unlines $ a [])
+
+-- | Ensures a directory exists.
+dirExists :: FilePath -> Property
+dirExists d = check (doesDirectoryExist d) $ Property (d ++ " exists") $
+ makeChange $ createDirectoryIfMissing True d