{-# LANGUAGE CPP #-}
module UnliftIO.Directory (
createDirectory
, createDirectoryIfMissing
#if MIN_VERSION_directory(1,3,1)
, createFileLink
, createDirectoryLink
, removeDirectoryLink
, getSymbolicLinkTarget
#endif
, removeDirectory
, removeDirectoryRecursive
#if MIN_VERSION_directory(1,2,7)
, removePathForcibly
#endif
, renameDirectory
#if MIN_VERSION_directory(1,2,5)
, listDirectory
#endif
, getDirectoryContents
, getCurrentDirectory
, setCurrentDirectory
#if MIN_VERSION_directory(1,2,3)
, withCurrentDirectory
#endif
, getHomeDirectory
#if MIN_VERSION_directory(1,2,3)
, XdgDirectory(..)
, getXdgDirectory
#endif
#if MIN_VERSION_directory(1,3,2)
, XdgDirectoryList(..)
, getXdgDirectoryList
#endif
, getAppUserDataDirectory
, getUserDocumentsDirectory
, getTemporaryDirectory
, removeFile
, renameFile
#if MIN_VERSION_directory(1,2,7)
, renamePath
#endif
, copyFile
#if MIN_VERSION_directory(1,2,6)
, copyFileWithMetadata
#endif
, canonicalizePath
#if MIN_VERSION_directory(1,2,2)
, makeAbsolute
#endif
, makeRelativeToCurrentDirectory
, findExecutable
#if MIN_VERSION_directory(1,2,2)
, findExecutables
#endif
#if MIN_VERSION_directory(1,2,4)
, findExecutablesInDirectories
#endif
, findFile
#if MIN_VERSION_directory(1,2,1)
, findFiles
#endif
#if MIN_VERSION_directory(1,2,6)
, findFileWith
#endif
#if MIN_VERSION_directory(1,2,1)
, findFilesWith
#endif
#if MIN_VERSION_directory(1,2,4)
, exeExtension
#endif
#if MIN_VERSION_directory(1,2,7)
, getFileSize
#endif
#if MIN_VERSION_directory(1,2,7)
, doesPathExist
#endif
, doesFileExist
, doesDirectoryExist
#if MIN_VERSION_directory(1,3,0)
, pathIsSymbolicLink
#endif
, Permissions
, emptyPermissions
, readable
, writable
, executable
, searchable
, setOwnerReadable
, setOwnerWritable
, setOwnerExecutable
, setOwnerSearchable
, getPermissions
, setPermissions
, copyPermissions
#if MIN_VERSION_directory(1,2,3)
, getAccessTime
#endif
, getModificationTime
#if MIN_VERSION_directory(1,2,3)
, setAccessTime
, setModificationTime
#endif
) where
import Control.Monad.IO.Unlift
import Data.Time.Clock
import qualified System.Directory as D
import System.Directory
( Permissions
#if MIN_VERSION_directory(1,2,3)
, XdgDirectory(..)
#endif
#if MIN_VERSION_directory(1,3,2)
, XdgDirectoryList(..)
#endif
, emptyPermissions
#if MIN_VERSION_directory(1,2,4)
, exeExtension
#endif
, executable
, readable
, searchable
, setOwnerExecutable
, setOwnerReadable
, setOwnerSearchable
, setOwnerWritable
, writable
)
{-# INLINE createDirectory #-}
createDirectory :: MonadIO m => FilePath -> m ()
createDirectory :: FilePath -> m ()
createDirectory = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> (FilePath -> IO ()) -> FilePath -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO ()
D.createDirectory
{-# INLINE createDirectoryIfMissing #-}
createDirectoryIfMissing :: MonadIO m => Bool -> FilePath -> m ()
createDirectoryIfMissing :: Bool -> FilePath -> m ()
createDirectoryIfMissing Bool
create_parents FilePath
path0 =
IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (Bool -> FilePath -> IO ()
D.createDirectoryIfMissing Bool
create_parents FilePath
path0)
#if MIN_VERSION_directory(1,3,1)
{-# INLINE createFileLink #-}
createFileLink
:: MonadIO m
=> FilePath
-> FilePath
-> m ()
createFileLink :: FilePath -> FilePath -> m ()
createFileLink FilePath
targetPath FilePath
linkPath =
IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> FilePath -> IO ()
D.createFileLink FilePath
targetPath FilePath
linkPath)
createDirectoryLink :: MonadIO m => FilePath -> FilePath -> m ()
createDirectoryLink :: FilePath -> FilePath -> m ()
createDirectoryLink FilePath
targetPath FilePath
linkPath =
IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> FilePath -> IO ()
D.createDirectoryLink FilePath
targetPath FilePath
linkPath)
removeDirectoryLink :: MonadIO m => FilePath -> m ()
removeDirectoryLink :: FilePath -> m ()
removeDirectoryLink FilePath
linkPath =
IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> IO ()
D.removeDirectoryLink FilePath
linkPath)
getSymbolicLinkTarget :: MonadIO m => FilePath -> m FilePath
getSymbolicLinkTarget :: FilePath -> m FilePath
getSymbolicLinkTarget FilePath
linkPath =
IO FilePath -> m FilePath
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> IO FilePath
D.getSymbolicLinkTarget FilePath
linkPath)
#endif
{-# INLINE removeDirectory #-}
removeDirectory :: MonadIO m => FilePath -> m ()
removeDirectory :: FilePath -> m ()
removeDirectory = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> (FilePath -> IO ()) -> FilePath -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO ()
D.removeDirectory
{-# INLINE removeDirectoryRecursive #-}
removeDirectoryRecursive :: MonadIO m => FilePath -> m ()
removeDirectoryRecursive :: FilePath -> m ()
removeDirectoryRecursive = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> (FilePath -> IO ()) -> FilePath -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO ()
D.removeDirectoryRecursive
#if MIN_VERSION_directory(1,2,7)
{-# INLINE removePathForcibly #-}
removePathForcibly :: MonadIO m => FilePath -> m ()
removePathForcibly :: FilePath -> m ()
removePathForcibly = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> (FilePath -> IO ()) -> FilePath -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO ()
D.removePathForcibly
#endif
{-# INLINE renameDirectory #-}
renameDirectory :: MonadIO m => FilePath -> FilePath -> m ()
renameDirectory :: FilePath -> FilePath -> m ()
renameDirectory FilePath
opath FilePath
npath = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> FilePath -> IO ()
D.renameDirectory FilePath
opath FilePath
npath)
#if MIN_VERSION_directory(1,2,5)
{-# INLINE listDirectory #-}
listDirectory :: MonadIO m => FilePath -> m [FilePath]
listDirectory :: FilePath -> m [FilePath]
listDirectory = IO [FilePath] -> m [FilePath]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [FilePath] -> m [FilePath])
-> (FilePath -> IO [FilePath]) -> FilePath -> m [FilePath]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO [FilePath]
D.listDirectory
#endif
{-# INLINE getDirectoryContents #-}
getDirectoryContents :: MonadIO m => FilePath -> m [FilePath]
getDirectoryContents :: FilePath -> m [FilePath]
getDirectoryContents = IO [FilePath] -> m [FilePath]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [FilePath] -> m [FilePath])
-> (FilePath -> IO [FilePath]) -> FilePath -> m [FilePath]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO [FilePath]
D.getDirectoryContents
{-# INLINE getCurrentDirectory #-}
getCurrentDirectory :: MonadIO m => m FilePath
getCurrentDirectory :: m FilePath
getCurrentDirectory = IO FilePath -> m FilePath
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO FilePath
D.getCurrentDirectory
{-# INLINE setCurrentDirectory #-}
setCurrentDirectory :: MonadIO m => FilePath -> m ()
setCurrentDirectory :: FilePath -> m ()
setCurrentDirectory = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> (FilePath -> IO ()) -> FilePath -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO ()
D.setCurrentDirectory
#if MIN_VERSION_directory(1,2,3)
{-# INLINE withCurrentDirectory #-}
withCurrentDirectory :: MonadUnliftIO m => FilePath -> m a -> m a
withCurrentDirectory :: FilePath -> m a -> m a
withCurrentDirectory FilePath
dir m a
action =
((forall a. m a -> IO a) -> IO a) -> m a
forall (m :: * -> *) b.
MonadUnliftIO m =>
((forall a. m a -> IO a) -> IO b) -> m b
withRunInIO (\forall a. m a -> IO a
u -> FilePath -> IO a -> IO a
forall a. FilePath -> IO a -> IO a
D.withCurrentDirectory FilePath
dir (m a -> IO a
forall a. m a -> IO a
u m a
action))
#endif
{-# INLINE getHomeDirectory #-}
getHomeDirectory :: MonadIO m => m FilePath
getHomeDirectory :: m FilePath
getHomeDirectory = IO FilePath -> m FilePath
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO FilePath
D.getHomeDirectory
#if MIN_VERSION_directory(1,2,3)
{-# INLINE getXdgDirectory #-}
getXdgDirectory :: MonadIO m => XdgDirectory -> FilePath -> m FilePath
getXdgDirectory :: XdgDirectory -> FilePath -> m FilePath
getXdgDirectory XdgDirectory
xdgDir FilePath
suffix = IO FilePath -> m FilePath
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (XdgDirectory -> FilePath -> IO FilePath
D.getXdgDirectory XdgDirectory
xdgDir FilePath
suffix)
#endif
#if MIN_VERSION_directory(1,3,2)
getXdgDirectoryList :: MonadIO m => XdgDirectoryList -> m [FilePath]
getXdgDirectoryList :: XdgDirectoryList -> m [FilePath]
getXdgDirectoryList XdgDirectoryList
xdgDirectoryList =
IO [FilePath] -> m [FilePath]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (XdgDirectoryList -> IO [FilePath]
D.getXdgDirectoryList XdgDirectoryList
xdgDirectoryList)
#endif
{-# INLINE getAppUserDataDirectory #-}
getAppUserDataDirectory :: MonadIO m => FilePath -> m FilePath
getAppUserDataDirectory :: FilePath -> m FilePath
getAppUserDataDirectory = IO FilePath -> m FilePath
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FilePath -> m FilePath)
-> (FilePath -> IO FilePath) -> FilePath -> m FilePath
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO FilePath
D.getAppUserDataDirectory
{-# INLINE getUserDocumentsDirectory #-}
getUserDocumentsDirectory :: MonadIO m => m FilePath
getUserDocumentsDirectory :: m FilePath
getUserDocumentsDirectory = IO FilePath -> m FilePath
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO FilePath
D.getUserDocumentsDirectory
{-# INLINE getTemporaryDirectory #-}
getTemporaryDirectory :: MonadIO m => m FilePath
getTemporaryDirectory :: m FilePath
getTemporaryDirectory = IO FilePath -> m FilePath
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO FilePath
D.getTemporaryDirectory
{-# INLINE removeFile #-}
removeFile :: MonadIO m => FilePath -> m ()
removeFile :: FilePath -> m ()
removeFile = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> (FilePath -> IO ()) -> FilePath -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO ()
D.removeFile
{-# INLINE renameFile #-}
renameFile :: MonadIO m => FilePath -> FilePath -> m ()
renameFile :: FilePath -> FilePath -> m ()
renameFile FilePath
opath FilePath
npath = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> FilePath -> IO ()
D.renameFile FilePath
opath FilePath
npath)
#if MIN_VERSION_directory(1,2,7)
{-# INLINE renamePath #-}
renamePath :: MonadIO m => FilePath -> FilePath -> m ()
renamePath :: FilePath -> FilePath -> m ()
renamePath FilePath
opath FilePath
npath = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> FilePath -> IO ()
D.renamePath FilePath
opath FilePath
npath)
#endif
{-# INLINE copyFile #-}
copyFile :: MonadIO m => FilePath -> FilePath -> m ()
copyFile :: FilePath -> FilePath -> m ()
copyFile FilePath
fromFPath FilePath
toFPath = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> FilePath -> IO ()
D.copyFile FilePath
fromFPath FilePath
toFPath)
#if MIN_VERSION_directory(1,2,6)
{-# INLINE copyFileWithMetadata #-}
copyFileWithMetadata :: MonadIO m => FilePath -> FilePath -> m ()
copyFileWithMetadata :: FilePath -> FilePath -> m ()
copyFileWithMetadata FilePath
src FilePath
dst = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> FilePath -> IO ()
D.copyFileWithMetadata FilePath
src FilePath
dst)
#endif
{-# INLINE canonicalizePath #-}
canonicalizePath :: MonadIO m => FilePath -> m FilePath
canonicalizePath :: FilePath -> m FilePath
canonicalizePath = IO FilePath -> m FilePath
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FilePath -> m FilePath)
-> (FilePath -> IO FilePath) -> FilePath -> m FilePath
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO FilePath
D.canonicalizePath
#if MIN_VERSION_directory(1,2,2)
{-# INLINE makeAbsolute #-}
makeAbsolute :: MonadIO m => FilePath -> m FilePath
makeAbsolute :: FilePath -> m FilePath
makeAbsolute = IO FilePath -> m FilePath
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FilePath -> m FilePath)
-> (FilePath -> IO FilePath) -> FilePath -> m FilePath
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO FilePath
D.makeAbsolute
#endif
{-# INLINE makeRelativeToCurrentDirectory #-}
makeRelativeToCurrentDirectory :: MonadIO m => FilePath -> m FilePath
makeRelativeToCurrentDirectory :: FilePath -> m FilePath
makeRelativeToCurrentDirectory = IO FilePath -> m FilePath
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FilePath -> m FilePath)
-> (FilePath -> IO FilePath) -> FilePath -> m FilePath
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO FilePath
D.makeRelativeToCurrentDirectory
{-# INLINE findExecutable #-}
findExecutable :: MonadIO m => String -> m (Maybe FilePath)
findExecutable :: FilePath -> m (Maybe FilePath)
findExecutable = IO (Maybe FilePath) -> m (Maybe FilePath)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe FilePath) -> m (Maybe FilePath))
-> (FilePath -> IO (Maybe FilePath))
-> FilePath
-> m (Maybe FilePath)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO (Maybe FilePath)
D.findExecutable
#if MIN_VERSION_directory(1,2,2)
{-# INLINE findExecutables #-}
findExecutables :: MonadIO m => String -> m [FilePath]
findExecutables :: FilePath -> m [FilePath]
findExecutables = IO [FilePath] -> m [FilePath]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [FilePath] -> m [FilePath])
-> (FilePath -> IO [FilePath]) -> FilePath -> m [FilePath]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO [FilePath]
D.findExecutables
#endif
#if MIN_VERSION_directory(1,2,4)
{-# INLINE findExecutablesInDirectories #-}
findExecutablesInDirectories ::
MonadIO m => [FilePath] -> String -> m [FilePath]
findExecutablesInDirectories :: [FilePath] -> FilePath -> m [FilePath]
findExecutablesInDirectories [FilePath]
path FilePath
binary =
IO [FilePath] -> m [FilePath]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO ([FilePath] -> FilePath -> IO [FilePath]
D.findExecutablesInDirectories [FilePath]
path FilePath
binary)
#endif
{-# INLINE findFile #-}
findFile :: MonadIO m => [FilePath] -> String -> m (Maybe FilePath)
findFile :: [FilePath] -> FilePath -> m (Maybe FilePath)
findFile [FilePath]
ds FilePath
name = IO (Maybe FilePath) -> m (Maybe FilePath)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO ([FilePath] -> FilePath -> IO (Maybe FilePath)
D.findFile [FilePath]
ds FilePath
name)
#if MIN_VERSION_directory(1,2,1)
{-# INLINE findFiles #-}
findFiles :: MonadIO m => [FilePath] -> String -> m [FilePath]
findFiles :: [FilePath] -> FilePath -> m [FilePath]
findFiles [FilePath]
ds FilePath
name = IO [FilePath] -> m [FilePath]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO ([FilePath] -> FilePath -> IO [FilePath]
D.findFiles [FilePath]
ds FilePath
name)
#endif
#if MIN_VERSION_directory(1,2,6)
{-# INLINE findFileWith #-}
findFileWith ::
MonadUnliftIO m
=> (FilePath -> m Bool)
-> [FilePath]
-> String
-> m (Maybe FilePath)
findFileWith :: (FilePath -> m Bool)
-> [FilePath] -> FilePath -> m (Maybe FilePath)
findFileWith FilePath -> m Bool
f [FilePath]
ds FilePath
name = ((forall a. m a -> IO a) -> IO (Maybe FilePath))
-> m (Maybe FilePath)
forall (m :: * -> *) b.
MonadUnliftIO m =>
((forall a. m a -> IO a) -> IO b) -> m b
withRunInIO (\forall a. m a -> IO a
u -> (FilePath -> IO Bool)
-> [FilePath] -> FilePath -> IO (Maybe FilePath)
D.findFileWith (m Bool -> IO Bool
forall a. m a -> IO a
u (m Bool -> IO Bool) -> (FilePath -> m Bool) -> FilePath -> IO Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> m Bool
f) [FilePath]
ds FilePath
name)
#endif
#if MIN_VERSION_directory(1,2,1)
{-# INLINE findFilesWith #-}
findFilesWith ::
MonadUnliftIO m
=> (FilePath -> m Bool)
-> [FilePath]
-> String
-> m [FilePath]
findFilesWith :: (FilePath -> m Bool) -> [FilePath] -> FilePath -> m [FilePath]
findFilesWith FilePath -> m Bool
f [FilePath]
ds FilePath
name = ((forall a. m a -> IO a) -> IO [FilePath]) -> m [FilePath]
forall (m :: * -> *) b.
MonadUnliftIO m =>
((forall a. m a -> IO a) -> IO b) -> m b
withRunInIO (\forall a. m a -> IO a
u -> (FilePath -> IO Bool) -> [FilePath] -> FilePath -> IO [FilePath]
D.findFilesWith (m Bool -> IO Bool
forall a. m a -> IO a
u (m Bool -> IO Bool) -> (FilePath -> m Bool) -> FilePath -> IO Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> m Bool
f) [FilePath]
ds FilePath
name)
#endif
#if MIN_VERSION_directory(1,2,7)
{-# INLINE getFileSize #-}
getFileSize :: MonadIO m => FilePath -> m Integer
getFileSize :: FilePath -> m Integer
getFileSize = IO Integer -> m Integer
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Integer -> m Integer)
-> (FilePath -> IO Integer) -> FilePath -> m Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO Integer
D.getFileSize
#endif
#if MIN_VERSION_directory(1,2,7)
{-# INLINE doesPathExist #-}
doesPathExist :: MonadIO m => FilePath -> m Bool
doesPathExist :: FilePath -> m Bool
doesPathExist = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> (FilePath -> IO Bool) -> FilePath -> m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO Bool
D.doesPathExist
#endif
{-# INLINE doesFileExist #-}
doesFileExist :: MonadIO m => FilePath -> m Bool
doesFileExist :: FilePath -> m Bool
doesFileExist = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> (FilePath -> IO Bool) -> FilePath -> m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO Bool
D.doesFileExist
{-# INLINE doesDirectoryExist #-}
doesDirectoryExist :: MonadIO m => FilePath -> m Bool
doesDirectoryExist :: FilePath -> m Bool
doesDirectoryExist = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> (FilePath -> IO Bool) -> FilePath -> m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO Bool
D.doesDirectoryExist
#if MIN_VERSION_directory(1,3,0)
{-# INLINE pathIsSymbolicLink #-}
pathIsSymbolicLink :: MonadIO m => FilePath -> m Bool
pathIsSymbolicLink :: FilePath -> m Bool
pathIsSymbolicLink = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> (FilePath -> IO Bool) -> FilePath -> m Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO Bool
D.pathIsSymbolicLink
#endif
{-# INLINE getPermissions #-}
getPermissions :: MonadIO m => FilePath -> m Permissions
getPermissions :: FilePath -> m Permissions
getPermissions = IO Permissions -> m Permissions
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Permissions -> m Permissions)
-> (FilePath -> IO Permissions) -> FilePath -> m Permissions
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO Permissions
D.getPermissions
{-# INLINE setPermissions #-}
setPermissions :: MonadIO m => FilePath -> Permissions -> m ()
setPermissions :: FilePath -> Permissions -> m ()
setPermissions FilePath
name Permissions
p = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> Permissions -> IO ()
D.setPermissions FilePath
name Permissions
p)
{-# INLINE copyPermissions #-}
copyPermissions :: MonadIO m => FilePath -> FilePath -> m ()
copyPermissions :: FilePath -> FilePath -> m ()
copyPermissions FilePath
source FilePath
dest = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> FilePath -> IO ()
D.copyPermissions FilePath
source FilePath
dest)
#if MIN_VERSION_directory(1,2,3)
{-# INLINE getAccessTime #-}
getAccessTime :: MonadIO m => FilePath -> m UTCTime
getAccessTime :: FilePath -> m UTCTime
getAccessTime = IO UTCTime -> m UTCTime
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO UTCTime -> m UTCTime)
-> (FilePath -> IO UTCTime) -> FilePath -> m UTCTime
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO UTCTime
D.getAccessTime
#endif
{-# INLINE getModificationTime #-}
getModificationTime :: MonadIO m => FilePath -> m UTCTime
getModificationTime :: FilePath -> m UTCTime
getModificationTime = IO UTCTime -> m UTCTime
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO UTCTime -> m UTCTime)
-> (FilePath -> IO UTCTime) -> FilePath -> m UTCTime
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO UTCTime
D.getModificationTime
#if MIN_VERSION_directory(1,2,3)
{-# INLINE setAccessTime #-}
setAccessTime :: MonadIO m => FilePath -> UTCTime -> m ()
setAccessTime :: FilePath -> UTCTime -> m ()
setAccessTime FilePath
path UTCTime
atime = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> UTCTime -> IO ()
D.setAccessTime FilePath
path UTCTime
atime)
setModificationTime :: MonadIO m => FilePath -> UTCTime -> m ()
setModificationTime :: FilePath -> UTCTime -> m ()
setModificationTime FilePath
path UTCTime
mtime = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> UTCTime -> IO ()
D.setModificationTime FilePath
path UTCTime
mtime)
#endif