From 90f86b8b2bb7f0a3c834387827c9ec2e1876f342 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 1 Apr 2014 01:12:05 -0400 Subject: not quite working docker container interface --- Propellor/Property/File.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Propellor/Property/File.hs') 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 -- cgit v1.3-2-g0d8e