From 51da8bf5c27b93f5c4e0c617090c9bb890751d98 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sun, 29 May 2016 17:28:12 +0200 Subject: [PATCH] HPath.IO: add createSymlink --- src/HPath/IO.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/HPath/IO.hs b/src/HPath/IO.hs index c908814..45eb9f6 100644 --- a/src/HPath/IO.hs +++ b/src/HPath/IO.hs @@ -56,6 +56,7 @@ module HPath.IO -- * File creation , createRegularFile , createDir + , createSymlink -- * File renaming/moving , renameFile , moveFile @@ -315,6 +316,7 @@ copyDirRecursiveOverwrite fromp destdirp RegularFile -> copyFileOverwrite f newdest _ -> return () + -- |Recreate a symlink. -- -- Throws: @@ -626,6 +628,20 @@ createDir :: Path Abs -> IO () createDir dest = createDirectory (fromAbs dest) newDirPerms +-- |Create a symlink. +-- +-- Throws: +-- +-- - `PermissionDenied` if output directory cannot be written to +-- - `AlreadyExists` if destination file already exists +-- +-- Note: calls `symlink` +createSymlink :: Path Abs -- ^ destination file + -> ByteString -- ^ path the symlink points to + -> IO () +createSymlink dest sympoint + = createSymbolicLink sympoint (fromAbs dest) + ----------------------------