From 256c5c3c572e56d3755914e40cfd9dfd94112bbb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 5 Jul 2017 16:47:12 -0400 Subject: File.isCopyOf: Fix bug that prevented this property from working when the destination file did not yet exist. This commit was sponsored by andrea rota. --- src/Propellor/Property/File.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Propellor/Property/File.hs b/src/Propellor/Property/File.hs index b1e72989..8d10b94c 100644 --- a/src/Propellor/Property/File.hs +++ b/src/Propellor/Property/File.hs @@ -154,7 +154,10 @@ f `isCopyOf` src = property desc $ go =<< (liftIO $ tryIO $ getFileStatus src) where desc = f ++ " is copy of " ++ src go (Right stat) = if isRegularFile stat - then gocmp =<< (liftIO $ cmp) + then ifM (liftIO $ doesFileExist f) + ( gocmp =<< (liftIO $ cmp) + , doit + ) else warningMessage (src ++ " is not a regular file") >> return FailedChange go (Left e) = warningMessage (show e) >> return FailedChange -- cgit v1.2.3