summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/File.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Propellor/Property/File.hs')
-rw-r--r--src/Propellor/Property/File.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Propellor/Property/File.hs b/src/Propellor/Property/File.hs
index 12a3e80a..08fdc780 100644
--- a/src/Propellor/Property/File.hs
+++ b/src/Propellor/Property/File.hs
@@ -97,10 +97,14 @@ dirExists :: FilePath -> Property NoInfo
dirExists d = check (not <$> doesDirectoryExist d) $ property (d ++ " exists") $
makeChange $ createDirectoryIfMissing True d
--- | Creates or atomically updates a symbolic link. Does not overwrite regular
--- files or directories.
-isSymlinkedTo :: FilePath -> FilePath -> Property NoInfo
-link `isSymlinkedTo` target = property desc $
+-- | The location that a symbolic link points to.
+newtype LinkTarget = LinkTarget FilePath
+
+-- | Creates or atomically updates a symbolic link.
+--
+-- Does not overwrite regular files or directories.
+isSymlinkedTo :: FilePath -> LinkTarget -> Property NoInfo
+link `isSymlinkedTo` (LinkTarget target) = property desc $
go =<< (liftIO $ tryIO $ getSymbolicLinkStatus link)
where
desc = link ++ " is symlinked to " ++ target