{-# LANGUAGE CPP #-}
-- | Unlifted "System.Directory".
--
-- @since 0.2.6.0

module UnliftIO.Directory (
    -- * Actions on directories
    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

  -- ** Current working directory
  , getCurrentDirectory
  , setCurrentDirectory
#if MIN_VERSION_directory(1,2,3)
  , withCurrentDirectory
#endif

  -- * Pre-defined directories
  , getHomeDirectory
#if MIN_VERSION_directory(1,2,3)
  , XdgDirectory(..)
  , getXdgDirectory
#endif
#if MIN_VERSION_directory(1,3,2)
  , XdgDirectoryList(..)
  , getXdgDirectoryList
#endif
  , getAppUserDataDirectory
  , getUserDocumentsDirectory
  , getTemporaryDirectory

  -- * Actions on files
  , 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

  -- * Existence tests
#if MIN_VERSION_directory(1,2,7)
  , doesPathExist
#endif
  , doesFileExist
  , doesDirectoryExist

#if MIN_VERSION_directory(1,3,0)
  -- * Symbolic links
  , pathIsSymbolicLink
#endif

  -- * Permissions
  , Permissions
  , emptyPermissions
  , readable
  , writable
  , executable
  , searchable
  , setOwnerReadable
  , setOwnerWritable
  , setOwnerExecutable
  , setOwnerSearchable
  , getPermissions
  , setPermissions
  , copyPermissions

  -- * Timestamps
#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
  )

-- | Lifted 'D.createDirectory'.
--
-- @since 0.2.6.0
{-# INLINE createDirectory #-}
createDirectory :: MonadIO m => FilePath -> m ()
createDirectory :: forall (m :: * -> *). MonadIO m => FilePath -> m ()
createDirectory = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO ()
D.createDirectory

-- | Lifted 'D.createDirectoryIfMissing'.
--
-- @since 0.2.6.0
{-# INLINE createDirectoryIfMissing #-}
createDirectoryIfMissing :: MonadIO m => Bool -> FilePath -> m ()
createDirectoryIfMissing :: forall (m :: * -> *). MonadIO m => Bool -> FilePath -> m ()
createDirectoryIfMissing Bool
create_parents FilePath
path0 =
  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)
-- | Lifted 'D.createFileLink'.
-- directory package version should be >= 1.3.1.
-- @since 0.2.16.0
{-# INLINE createFileLink #-}
createFileLink
  :: MonadIO m
  => FilePath  -- ^ path to the target file
  -> FilePath  -- ^ path of the link to be created
  -> m ()
createFileLink :: forall (m :: * -> *). MonadIO m => FilePath -> FilePath -> m ()
createFileLink FilePath
targetPath FilePath
linkPath =
  forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> FilePath -> IO ()
D.createFileLink FilePath
targetPath FilePath
linkPath)

-- | Lifted 'D.createDirectoryLink'.
--
-- @since 0.2.21.0
createDirectoryLink :: MonadIO m => FilePath -> FilePath -> m ()
createDirectoryLink :: forall (m :: * -> *). MonadIO m => FilePath -> FilePath -> m ()
createDirectoryLink FilePath
targetPath FilePath
linkPath =
  forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> FilePath -> IO ()
D.createDirectoryLink FilePath
targetPath FilePath
linkPath)

-- | Lifted 'D.removeDirectoryLink'.
--
-- @since 0.2.21.0
removeDirectoryLink :: MonadIO m => FilePath -> m ()
removeDirectoryLink :: forall (m :: * -> *). MonadIO m => FilePath -> m ()
removeDirectoryLink FilePath
linkPath =
  forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> IO ()
D.removeDirectoryLink FilePath
linkPath)

-- | Lifted 'D.getSymbolicLinkTarget'.
--
-- @since 0.2.21.0
getSymbolicLinkTarget :: MonadIO m => FilePath -> m FilePath
getSymbolicLinkTarget :: forall (m :: * -> *). MonadIO m => FilePath -> m FilePath
getSymbolicLinkTarget FilePath
linkPath =
  forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> IO FilePath
D.getSymbolicLinkTarget FilePath
linkPath)
#endif

-- | Lifted 'D.removeDirectory'.
--
-- @since 0.2.6.0
{-# INLINE removeDirectory #-}
removeDirectory :: MonadIO m => FilePath -> m ()
removeDirectory :: forall (m :: * -> *). MonadIO m => FilePath -> m ()
removeDirectory = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO ()
D.removeDirectory

-- | Lifted 'D.removeDirectoryRecursive'.
--
-- @since 0.2.6.0
{-# INLINE removeDirectoryRecursive #-}
removeDirectoryRecursive :: MonadIO m => FilePath -> m ()
removeDirectoryRecursive :: forall (m :: * -> *). MonadIO m => FilePath -> m ()
removeDirectoryRecursive = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO ()
D.removeDirectoryRecursive

#if MIN_VERSION_directory(1,2,7)
-- | Lifted 'D.removePathForcibly'.
--
-- @since 0.2.6.0
{-# INLINE removePathForcibly #-}
removePathForcibly :: MonadIO m => FilePath -> m ()
removePathForcibly :: forall (m :: * -> *). MonadIO m => FilePath -> m ()
removePathForcibly = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO ()
D.removePathForcibly
#endif

-- | Lifted 'D.renameDirectory'.
--
-- @since 0.2.6.0
{-# INLINE renameDirectory #-}
renameDirectory :: MonadIO m => FilePath -> FilePath -> m ()
renameDirectory :: forall (m :: * -> *). MonadIO m => FilePath -> FilePath -> m ()
renameDirectory FilePath
opath FilePath
npath = 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)
-- | Lifted 'D.listDirectory'.
--
-- @since 0.2.6.0
{-# INLINE listDirectory #-}
listDirectory :: MonadIO m => FilePath -> m [FilePath]
listDirectory :: forall (m :: * -> *). MonadIO m => FilePath -> m [FilePath]
listDirectory = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO [FilePath]
D.listDirectory
#endif

-- | Lifted 'D.getDirectoryContents'.
--
-- @since 0.2.6.0
{-# INLINE getDirectoryContents #-}
getDirectoryContents :: MonadIO m => FilePath -> m [FilePath]
getDirectoryContents :: forall (m :: * -> *). MonadIO m => FilePath -> m [FilePath]
getDirectoryContents = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO [FilePath]
D.getDirectoryContents

-- | Lifted 'D.getCurrentDirectory'.
--
-- @since 0.2.6.0
{-# INLINE getCurrentDirectory #-}
getCurrentDirectory :: MonadIO m => m FilePath
getCurrentDirectory :: forall (m :: * -> *). MonadIO m => m FilePath
getCurrentDirectory = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO FilePath
D.getCurrentDirectory

-- | Lifted 'D.setCurrentDirectory'.
--
-- @since 0.2.6.0
{-# INLINE setCurrentDirectory #-}
setCurrentDirectory :: MonadIO m => FilePath -> m ()
setCurrentDirectory :: forall (m :: * -> *). MonadIO m => FilePath -> m ()
setCurrentDirectory = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO ()
D.setCurrentDirectory

#if MIN_VERSION_directory(1,2,3)
-- | Unlifted 'D.withCurrentDirectory'.
--
-- @since 0.2.6.0
{-# INLINE withCurrentDirectory #-}
withCurrentDirectory :: MonadUnliftIO m => FilePath -> m a -> m a
withCurrentDirectory :: forall (m :: * -> *) a. MonadUnliftIO m => FilePath -> m a -> m a
withCurrentDirectory FilePath
dir m a
action =
  forall (m :: * -> *) b.
MonadUnliftIO m =>
((forall a. m a -> IO a) -> IO b) -> m b
withRunInIO (\forall a. m a -> IO a
u -> forall a. FilePath -> IO a -> IO a
D.withCurrentDirectory FilePath
dir (forall a. m a -> IO a
u m a
action))
#endif

-- | Lifted 'D.getHomeDirectory'.
--
-- @since 0.2.6.0
{-# INLINE getHomeDirectory #-}
getHomeDirectory :: MonadIO m => m FilePath
getHomeDirectory :: forall (m :: * -> *). MonadIO m => m FilePath
getHomeDirectory = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO FilePath
D.getHomeDirectory

#if MIN_VERSION_directory(1,2,3)
-- | Lifted 'D.getXdgDirectory'.
--
-- @since 0.2.6.0
{-# INLINE getXdgDirectory #-}
getXdgDirectory :: MonadIO m => XdgDirectory -> FilePath -> m FilePath
getXdgDirectory :: forall (m :: * -> *).
MonadIO m =>
XdgDirectory -> FilePath -> m FilePath
getXdgDirectory XdgDirectory
xdgDir FilePath
suffix = 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)
-- | Lifted 'D.getXdgDirectoryList'.
--
-- @since 0.2.21.0
getXdgDirectoryList :: MonadIO m => XdgDirectoryList -> m [FilePath]
getXdgDirectoryList :: forall (m :: * -> *). MonadIO m => XdgDirectoryList -> m [FilePath]
getXdgDirectoryList XdgDirectoryList
xdgDirectoryList =
  forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (XdgDirectoryList -> IO [FilePath]
D.getXdgDirectoryList XdgDirectoryList
xdgDirectoryList)
#endif

-- | Lifted 'D.getAppUserDataDirectory'.
--
-- @since 0.2.6.0
{-# INLINE getAppUserDataDirectory #-}
getAppUserDataDirectory :: MonadIO m => FilePath -> m FilePath
getAppUserDataDirectory :: forall (m :: * -> *). MonadIO m => FilePath -> m FilePath
getAppUserDataDirectory = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO FilePath
D.getAppUserDataDirectory

-- | Lifted 'D.getUserDocumentsDirectory'.
--
-- @since 0.2.6.0
{-# INLINE getUserDocumentsDirectory #-}
getUserDocumentsDirectory :: MonadIO m => m FilePath
getUserDocumentsDirectory :: forall (m :: * -> *). MonadIO m => m FilePath
getUserDocumentsDirectory = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO FilePath
D.getUserDocumentsDirectory

-- | Lifted 'D.getTemporaryDirectory'.
--
-- @since 0.2.6.0
{-# INLINE getTemporaryDirectory #-}
getTemporaryDirectory :: MonadIO m => m FilePath
getTemporaryDirectory :: forall (m :: * -> *). MonadIO m => m FilePath
getTemporaryDirectory = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO FilePath
D.getTemporaryDirectory

-- | Lifted 'D.removeFile'.
--
-- @since 0.2.6.0
{-# INLINE removeFile #-}
removeFile :: MonadIO m => FilePath -> m ()
removeFile :: forall (m :: * -> *). MonadIO m => FilePath -> m ()
removeFile = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO ()
D.removeFile

-- | Lifted 'D.renameFile'.
--
-- @since 0.2.6.0
{-# INLINE renameFile #-}
renameFile :: MonadIO m => FilePath -> FilePath -> m ()
renameFile :: forall (m :: * -> *). MonadIO m => FilePath -> FilePath -> m ()
renameFile FilePath
opath FilePath
npath = 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)
-- | Lifted 'D.renamePath'.
--
-- @since 0.2.6.0
{-# INLINE renamePath #-}
renamePath :: MonadIO m => FilePath -> FilePath -> m ()
renamePath :: forall (m :: * -> *). MonadIO m => FilePath -> FilePath -> m ()
renamePath FilePath
opath FilePath
npath = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> FilePath -> IO ()
D.renamePath FilePath
opath FilePath
npath)
#endif

-- | Lifted 'D.copyFile'.
--
-- @since 0.2.6.0
{-# INLINE copyFile #-}
copyFile :: MonadIO m => FilePath -> FilePath -> m ()
copyFile :: forall (m :: * -> *). MonadIO m => FilePath -> FilePath -> m ()
copyFile FilePath
fromFPath FilePath
toFPath = 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)
-- | Lifted 'D.copyFileWithMetadata'.
--
-- @since 0.2.6.0
{-# INLINE copyFileWithMetadata #-}
copyFileWithMetadata :: MonadIO m => FilePath -> FilePath -> m ()
copyFileWithMetadata :: forall (m :: * -> *). MonadIO m => FilePath -> FilePath -> m ()
copyFileWithMetadata FilePath
src FilePath
dst = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> FilePath -> IO ()
D.copyFileWithMetadata FilePath
src FilePath
dst)
#endif

-- | Lifted 'D.canonicalizePath'.
--
-- @since 0.2.6.0
{-# INLINE canonicalizePath #-}
canonicalizePath :: MonadIO m => FilePath -> m FilePath
canonicalizePath :: forall (m :: * -> *). MonadIO m => FilePath -> m FilePath
canonicalizePath = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO FilePath
D.canonicalizePath

#if MIN_VERSION_directory(1,2,2)
-- | Lifted 'D.makeAbsolute'.
--
-- @since 0.2.6.0
{-# INLINE makeAbsolute #-}
makeAbsolute :: MonadIO m => FilePath -> m FilePath
makeAbsolute :: forall (m :: * -> *). MonadIO m => FilePath -> m FilePath
makeAbsolute = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO FilePath
D.makeAbsolute
#endif

-- | Lifted 'D.makeRelativeToCurrentDirectory'.
--
-- @since 0.2.6.0
{-# INLINE makeRelativeToCurrentDirectory #-}
makeRelativeToCurrentDirectory :: MonadIO m => FilePath -> m FilePath
makeRelativeToCurrentDirectory :: forall (m :: * -> *). MonadIO m => FilePath -> m FilePath
makeRelativeToCurrentDirectory = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO FilePath
D.makeRelativeToCurrentDirectory

-- | Lifted 'D.findExecutable'.
--
-- @since 0.2.6.0
{-# INLINE findExecutable #-}
findExecutable :: MonadIO m => String -> m (Maybe FilePath)
findExecutable :: forall (m :: * -> *). MonadIO m => FilePath -> m (Maybe FilePath)
findExecutable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO (Maybe FilePath)
D.findExecutable

#if MIN_VERSION_directory(1,2,2)
-- | Lifted 'D.findExecutables'.
--
-- @since 0.2.6.0
{-# INLINE findExecutables #-}
findExecutables :: MonadIO m => String -> m [FilePath]
findExecutables :: forall (m :: * -> *). MonadIO m => FilePath -> m [FilePath]
findExecutables = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO [FilePath]
D.findExecutables
#endif

#if MIN_VERSION_directory(1,2,4)
-- | Lifted 'D.findExecutablesInDirectories'.
--
-- @since 0.2.6.0
{-# INLINE findExecutablesInDirectories #-}
findExecutablesInDirectories ::
     MonadIO m => [FilePath] -> String -> m [FilePath]
findExecutablesInDirectories :: forall (m :: * -> *).
MonadIO m =>
[FilePath] -> FilePath -> m [FilePath]
findExecutablesInDirectories [FilePath]
path FilePath
binary =
  forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO ([FilePath] -> FilePath -> IO [FilePath]
D.findExecutablesInDirectories [FilePath]
path FilePath
binary)
#endif

-- | Lifted 'D.findFile'.
--
-- @since 0.2.6.0
{-# INLINE findFile #-}
findFile :: MonadIO m => [FilePath] -> String -> m (Maybe FilePath)
findFile :: forall (m :: * -> *).
MonadIO m =>
[FilePath] -> FilePath -> m (Maybe FilePath)
findFile [FilePath]
ds FilePath
name = 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)
-- | Lifted 'D.findFiles'.
--
-- @since 0.2.6.0
{-# INLINE findFiles #-}
findFiles :: MonadIO m => [FilePath] -> String -> m [FilePath]
findFiles :: forall (m :: * -> *).
MonadIO m =>
[FilePath] -> FilePath -> m [FilePath]
findFiles [FilePath]
ds FilePath
name = 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)
-- | Unlifted 'D.findFileWith'.
--
-- @since 0.2.6.0
{-# INLINE findFileWith #-}
findFileWith ::
     MonadUnliftIO m
  => (FilePath -> m Bool)
  -> [FilePath]
  -> String
  -> m (Maybe FilePath)
findFileWith :: forall (m :: * -> *).
MonadUnliftIO m =>
(FilePath -> m Bool)
-> [FilePath] -> FilePath -> m (Maybe FilePath)
findFileWith FilePath -> m Bool
f [FilePath]
ds FilePath
name = 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 (forall a. m a -> IO a
u 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)
-- | Unlifted 'D.findFilesWith'.
--
-- @since 0.2.6.0
{-# INLINE findFilesWith #-}
findFilesWith ::
     MonadUnliftIO m
  => (FilePath -> m Bool)
  -> [FilePath]
  -> String
  -> m [FilePath]
findFilesWith :: forall (m :: * -> *).
MonadUnliftIO m =>
(FilePath -> m Bool) -> [FilePath] -> FilePath -> m [FilePath]
findFilesWith FilePath -> m Bool
f [FilePath]
ds FilePath
name = 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 (forall a. m a -> IO a
u 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)
-- | Lifted 'D.getFileSize'.
--
-- @since 0.2.6.0
{-# INLINE getFileSize #-}
getFileSize :: MonadIO m => FilePath -> m Integer
getFileSize :: forall (m :: * -> *). MonadIO m => FilePath -> m Integer
getFileSize = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO Integer
D.getFileSize
#endif

#if MIN_VERSION_directory(1,2,7)
-- | Lifted 'D.doesPathExist'.
--
-- @since 0.2.6.0
{-# INLINE doesPathExist #-}
doesPathExist :: MonadIO m => FilePath -> m Bool
doesPathExist :: forall (m :: * -> *). MonadIO m => FilePath -> m Bool
doesPathExist = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO Bool
D.doesPathExist
#endif

-- | Lifted 'D.doesFileExist'.
--
-- @since 0.2.6.0
{-# INLINE doesFileExist #-}
doesFileExist :: MonadIO m => FilePath -> m Bool
doesFileExist :: forall (m :: * -> *). MonadIO m => FilePath -> m Bool
doesFileExist = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO Bool
D.doesFileExist

-- | Lifted 'D.doesDirectoryExist'.
--
-- @since 0.2.6.0
{-# INLINE doesDirectoryExist #-}
doesDirectoryExist :: MonadIO m => FilePath -> m Bool
doesDirectoryExist :: forall (m :: * -> *). MonadIO m => FilePath -> m Bool
doesDirectoryExist = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO Bool
D.doesDirectoryExist

#if MIN_VERSION_directory(1,3,0)
-- | Lifted 'D.pathIsSymbolicLink'.
--
-- @since 0.2.6.0
{-# INLINE pathIsSymbolicLink #-}
pathIsSymbolicLink :: MonadIO m => FilePath -> m Bool
pathIsSymbolicLink :: forall (m :: * -> *). MonadIO m => FilePath -> m Bool
pathIsSymbolicLink = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO Bool
D.pathIsSymbolicLink
#endif

-- | Lifted 'D.getPermissions'.
--
-- @since 0.2.6.0
{-# INLINE getPermissions #-}
getPermissions :: MonadIO m => FilePath -> m Permissions
getPermissions :: forall (m :: * -> *). MonadIO m => FilePath -> m Permissions
getPermissions = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO Permissions
D.getPermissions

-- | Lifted 'D.setPermissions'.
--
-- @since 0.2.6.0
{-# INLINE setPermissions #-}
setPermissions :: MonadIO m => FilePath -> Permissions -> m ()
setPermissions :: forall (m :: * -> *). MonadIO m => FilePath -> Permissions -> m ()
setPermissions FilePath
name Permissions
p = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> Permissions -> IO ()
D.setPermissions FilePath
name Permissions
p)

-- | Lifted 'D.copyPermissions'.
--
-- @since 0.2.6.0
{-# INLINE copyPermissions #-}
copyPermissions :: MonadIO m => FilePath -> FilePath -> m ()
copyPermissions :: forall (m :: * -> *). MonadIO m => FilePath -> FilePath -> m ()
copyPermissions FilePath
source FilePath
dest = 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)
-- | Lifted 'D.getAccessTime'.
--
-- @since 0.2.6.0
{-# INLINE getAccessTime #-}
getAccessTime :: MonadIO m => FilePath -> m UTCTime
getAccessTime :: forall (m :: * -> *). MonadIO m => FilePath -> m UTCTime
getAccessTime = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO UTCTime
D.getAccessTime
#endif

-- | Lifted 'D.getModificationTime'.
--
-- @since 0.2.6.0
{-# INLINE getModificationTime #-}
getModificationTime :: MonadIO m => FilePath -> m UTCTime
getModificationTime :: forall (m :: * -> *). MonadIO m => FilePath -> m UTCTime
getModificationTime = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilePath -> IO UTCTime
D.getModificationTime

#if MIN_VERSION_directory(1,2,3)
-- | Lifted 'D.setAccessTime'.
--
-- @since 0.2.6.0
{-# INLINE setAccessTime #-}
setAccessTime :: MonadIO m => FilePath -> UTCTime -> m ()
setAccessTime :: forall (m :: * -> *). MonadIO m => FilePath -> UTCTime -> m ()
setAccessTime FilePath
path UTCTime
atime = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> UTCTime -> IO ()
D.setAccessTime FilePath
path UTCTime
atime)

-- | Lifted 'D.setModificationTime'.
--
-- @since 0.2.6.0
setModificationTime :: MonadIO m => FilePath -> UTCTime -> m ()
setModificationTime :: forall (m :: * -> *). MonadIO m => FilePath -> UTCTime -> m ()
setModificationTime FilePath
path UTCTime
mtime = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (FilePath -> UTCTime -> IO ()
D.setModificationTime FilePath
path UTCTime
mtime)
#endif