diff options
| author | Joey Hess <joeyh@joeyh.name> | 2017-07-05 16:47:12 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2017-07-05 16:47:12 -0400 |
| commit | 256c5c3c572e56d3755914e40cfd9dfd94112bbb (patch) | |
| tree | df7877de2ee647713fb9e94bdb385dba070ae1f9 | |
| parent | 36671f5c992905aa71722b16d800313f60a02622 (diff) | |
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.
| -rw-r--r-- | debian/changelog | 2 | ||||
| -rw-r--r-- | src/Propellor/Property/File.hs | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog index e92a24e1..7917bbf6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,6 +21,8 @@ propellor (4.1.0) UNRELEASED; urgency=medium * Propellor.Property.XFCE added with some useful properties for the desktop environment. * Added File.applyPath property. + * File.isCopyOf: Fix bug that prevented this property from working + when the destination file did not yet exist. -- Joey Hess <id@joeyh.name> Tue, 20 Jun 2017 10:55:37 -0400 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 |
