{-# OPTIONS -Wall #-} module Shelly.Directory where import System.IO.Error (modifyIOError, ioeSetLocation, ioeGetLocation) import qualified System.PosixCompat as Posix createFileLink :: String -> String -> IO () createFileLink :: String -> String -> IO () createFileLink String target String link = (IOError -> String -> IOError `ioeAddLocation` String "createFileLink") forall a. (IOError -> IOError) -> IO a -> IO a `modifyIOError` do String -> String -> IO () Posix.createSymbolicLink String target String link getSymbolicLinkTarget :: String -> IO String getSymbolicLinkTarget :: String -> IO String getSymbolicLinkTarget String path = (IOError -> String -> IOError `ioeAddLocation` String "getSymbolicLinkTarget") forall a. (IOError -> IOError) -> IO a -> IO a `modifyIOError` do String -> IO String Posix.readSymbolicLink String path ioeAddLocation :: IOError -> String -> IOError ioeAddLocation :: IOError -> String -> IOError ioeAddLocation IOError e String loc = do IOError -> String -> IOError ioeSetLocation IOError e String newLoc where newLoc :: String newLoc = String loc forall a. [a] -> [a] -> [a] ++ if forall (t :: * -> *) a. Foldable t => t a -> Bool Prelude.null String oldLoc then String "" else String ":" forall a. [a] -> [a] -> [a] ++ String oldLoc oldLoc :: String oldLoc = IOError -> String ioeGetLocation IOError e