unliftio-0.2.11: The MonadUnliftIO typeclass for unlifting monads to IO (batteries included)

Safe Haskell | Safe
Language | Haskell2010

UnliftIO.Directory

Contents

- Actions on directories
  - Current working directory
- Pre-defined directories
- Actions on files
- Existence tests
- Symbolic links
- Permissions
- Timestamps

Description

Unlifted System.Directory.

Since: 0.2.6.0

Synopsis

- createDirectory :: MonadIO m => FilePath -> m ()
- createDirectoryIfMissing :: MonadIO m => Bool -> FilePath -> m ()
- removeDirectory :: MonadIO m => FilePath -> m ()
- removeDirectoryRecursive :: MonadIO m => FilePath -> m ()
- removePathForcibly :: MonadIO m => FilePath -> m ()
- renameDirectory :: MonadIO m => FilePath -> FilePath -> m ()
- listDirectory :: MonadIO m => FilePath -> m [FilePath]
- getDirectoryContents :: MonadIO m => FilePath -> m [FilePath]
- getCurrentDirectory :: MonadIO m => m FilePath
- setCurrentDirectory :: MonadIO m => FilePath -> m ()
- withCurrentDirectory :: MonadUnliftIO m => FilePath -> m a -> m a
- getHomeDirectory :: MonadIO m => m FilePath
- data XdgDirectory
  - = XdgData
  - | XdgConfig
  - | XdgCache
- getXdgDirectory :: MonadIO m => XdgDirectory -> FilePath -> m FilePath
- getAppUserDataDirectory :: MonadIO m => FilePath -> m FilePath
- getUserDocumentsDirectory :: MonadIO m => m FilePath
- getTemporaryDirectory :: MonadIO m => m FilePath
- removeFile :: MonadIO m => FilePath -> m ()
- renameFile :: MonadIO m => FilePath -> FilePath -> m ()
- renamePath :: MonadIO m => FilePath -> FilePath -> m ()
- copyFile :: MonadIO m => FilePath -> FilePath -> m ()
- copyFileWithMetadata :: MonadIO m => FilePath -> FilePath -> m ()
- canonicalizePath :: MonadIO m => FilePath -> m FilePath
- makeAbsolute :: MonadIO m => FilePath -> m FilePath
- makeRelativeToCurrentDirectory :: MonadIO m => FilePath -> m FilePath
- findExecutable :: MonadIO m => String -> m (Maybe FilePath)
- findExecutables :: MonadIO m => String -> m [FilePath]
- findExecutablesInDirectories :: MonadIO m => [FilePath] -> String -> m [FilePath]
- findFile :: MonadIO m => [FilePath] -> String -> m (Maybe FilePath)
- findFiles :: MonadIO m => [FilePath] -> String -> m [FilePath]
- findFileWith :: MonadUnliftIO m => (FilePath -> m Bool) -> [FilePath] -> String -> m (Maybe FilePath)
- findFilesWith :: MonadUnliftIO m => (FilePath -> m Bool) -> [FilePath] -> String -> m [FilePath]
- exeExtension :: String
- getFileSize :: MonadIO m => FilePath -> m Integer
- doesPathExist :: MonadIO m => FilePath -> m Bool
- doesFileExist :: MonadIO m => FilePath -> m Bool
- doesDirectoryExist :: MonadIO m => FilePath -> m Bool
- pathIsSymbolicLink :: MonadIO m => FilePath -> m Bool
- data Permissions
- emptyPermissions :: Permissions
- readable :: Permissions -> Bool
- writable :: Permissions -> Bool
- executable :: Permissions -> Bool
- searchable :: Permissions -> Bool
- setOwnerReadable :: Bool -> Permissions -> Permissions
- setOwnerWritable :: Bool -> Permissions -> Permissions
- setOwnerExecutable :: Bool -> Permissions -> Permissions
- setOwnerSearchable :: Bool -> Permissions -> Permissions
- getPermissions :: MonadIO m => FilePath -> m Permissions
- setPermissions :: MonadIO m => FilePath -> Permissions -> m ()
- copyPermissions :: MonadIO m => FilePath -> FilePath -> m ()
- getAccessTime :: MonadIO m => FilePath -> m UTCTime
- getModificationTime :: MonadIO m => FilePath -> m UTCTime
- setAccessTime :: MonadIO m => FilePath -> UTCTime -> m ()
- setModificationTime :: MonadIO m => FilePath -> UTCTime -> m ()

# Actions on directories

createDirectory :: MonadIO m => FilePath -> m () Source #

Lifted `createDirectory`.

Since: 0.2.6.0

createDirectoryIfMissing :: MonadIO m => Bool -> FilePath -> m () Source #

Lifted `createDirectoryIfMissing`.

Since: 0.2.6.0

removeDirectory :: MonadIO m => FilePath -> m () Source #

Lifted `removeDirectory`.

Since: 0.2.6.0

removeDirectoryRecursive :: MonadIO m => FilePath -> m () Source #

Lifted `removeDirectoryRecursive`.

Since: 0.2.6.0

removePathForcibly :: MonadIO m => FilePath -> m () Source #

Lifted `removePathForcibly`.

Since: 0.2.6.0

renameDirectory :: MonadIO m => FilePath -> FilePath -> m () Source #

Lifted `renameDirectory`.

Since: 0.2.6.0

listDirectory :: MonadIO m => FilePath -> m [FilePath] Source #

Lifted `listDirectory`.

Since: 0.2.6.0

getDirectoryContents :: MonadIO m => FilePath -> m [FilePath] Source #

Lifted `getDirectoryContents`.

Since: 0.2.6.0

## Current working directory

getCurrentDirectory :: MonadIO m => m FilePath Source #

Lifted `getCurrentDirectory`.

Since: 0.2.6.0

setCurrentDirectory :: MonadIO m => FilePath -> m () Source #

Lifted `setCurrentDirectory`.

Since: 0.2.6.0

withCurrentDirectory :: MonadUnliftIO m => FilePath -> m a -> m a Source #

Unlifted `withCurrentDirectory`.

Since: 0.2.6.0

# Pre-defined directories

getHomeDirectory :: MonadIO m => m FilePath Source #

Lifted `getHomeDirectory`.

Since: 0.2.6.0

data XdgDirectory Source #

Special directories for storing user-specific application data, configuration, and cache files, as specified by the XDG Base Directory Specification.

Note: On Windows, `XdgData` and `XdgConfig` map to the same directory.

Since: directory-1.2.3.0

Constructors

XdgData | For data files (e.g. images). Defaults to `~/.local/share` and can be overridden by the `XDG_DATA_HOME` environment variable. On Windows, it is `%APPDATA%` (e.g. `C:/Users/<user>/AppData/Roaming`). Can be considered as the user-specific equivalent of `/usr/share`.
XdgConfig | For configuration files. Defaults to `~/.config` and can be overridden by the `XDG_CONFIG_HOME` environment variable. On Windows, it is `%APPDATA%` (e.g. `C:/Users/<user>/AppData/Roaming`). Can be considered as the user-specific equivalent of `/etc`.
XdgCache | For non-essential files (e.g. cache). Defaults to `~/.cache` and can be overridden by the `XDG_CACHE_HOME` environment variable. On Windows, it is `%LOCALAPPDATA%` (e.g. `C:/Users/<user>/AppData/Local`). Can be considered as the user-specific equivalent of `/var/cache`.

Instances

Bounded XdgDirectory |
Instance details Defined in System.Directory.Internal.Common Methods minBound :: XdgDirectory Source # maxBound :: XdgDirectory Source #
Enum XdgDirectory |

Instance details

Defined in System.Directory.Internal.Common

Methods

succ :: XdgDirectory -> XdgDirectory Source #

pred :: XdgDirectory -> XdgDirectory Source #

toEnum :: Int -> XdgDirectory Source #

fromEnum :: XdgDirectory -> Int Source #

enumFrom :: XdgDirectory -> [XdgDirectory] Source #

enumFromThen :: XdgDirectory -> XdgDirectory -> [XdgDirectory] Source #

enumFromTo :: XdgDirectory -> XdgDirectory -> [XdgDirectory] Source #

enumFromThenTo :: XdgDirectory -> XdgDirectory -> XdgDirectory -> [XdgDirectory] Source #

Eq XdgDirectory |
Instance details Defined in System.Directory.Internal.Common Methods (==) :: XdgDirectory -> XdgDirectory -> Bool Source # (/=) :: XdgDirectory -> XdgDirectory -> Bool Source #
Ord XdgDirectory |

Instance details

Defined in System.Directory.Internal.Common

Methods

compare :: XdgDirectory -> XdgDirectory -> Ordering Source #

(<) :: XdgDirectory -> XdgDirectory -> Bool Source #

(<=) :: XdgDirectory -> XdgDirectory -> Bool Source #

(>) :: XdgDirectory -> XdgDirectory -> Bool Source #

(>=) :: XdgDirectory -> XdgDirectory -> Bool Source #

max :: XdgDirectory -> XdgDirectory -> XdgDirectory Source #

min :: XdgDirectory -> XdgDirectory -> XdgDirectory Source #

Read XdgDirectory |
Instance details Defined in System.Directory.Internal.Common Methods readsPrec :: Int -> ReadS XdgDirectory Source # readList :: ReadS [XdgDirectory] Source # readPrec :: ReadPrec XdgDirectory Source # readListPrec :: ReadPrec [XdgDirectory] Source #
Show XdgDirectory |
Instance details Defined in System.Directory.Internal.Common Methods showsPrec :: Int -> XdgDirectory -> ShowS Source # show :: XdgDirectory -> String Source # showList :: [XdgDirectory] -> ShowS Source #

getXdgDirectory :: MonadIO m => XdgDirectory -> FilePath -> m FilePath Source #

Lifted `getXdgDirectory`.

Since: 0.2.6.0

getAppUserDataDirectory :: MonadIO m => FilePath -> m FilePath Source #

Lifted `getAppUserDataDirectory`.

Since: 0.2.6.0

getUserDocumentsDirectory :: MonadIO m => m FilePath Source #

Lifted `getUserDocumentsDirectory`.

Since: 0.2.6.0

getTemporaryDirectory :: MonadIO m => m FilePath Source #

Lifted `getTemporaryDirectory`.

Since: 0.2.6.0

# Actions on files

removeFile :: MonadIO m => FilePath -> m () Source #

Lifted `removeFile`.

Since: 0.2.6.0

renameFile :: MonadIO m => FilePath -> FilePath -> m () Source #

Lifted `renameFile`.

Since: 0.2.6.0

renamePath :: MonadIO m => FilePath -> FilePath -> m () Source #

Lifted `renamePath`.

Since: 0.2.6.0

copyFile :: MonadIO m => FilePath -> FilePath -> m () Source #

Lifted `copyFile`.

Since: 0.2.6.0

copyFileWithMetadata :: MonadIO m => FilePath -> FilePath -> m () Source #

Lifted `copyFileWithMetadata`.

Since: 0.2.6.0

canonicalizePath :: MonadIO m => FilePath -> m FilePath Source #

Lifted `canonicalizePath`.

Since: 0.2.6.0

makeAbsolute :: MonadIO m => FilePath -> m FilePath Source #

Lifted `makeAbsolute`.

Since: 0.2.6.0

makeRelativeToCurrentDirectory :: MonadIO m => FilePath -> m FilePath Source #

Lifted `makeRelativeToCurrentDirectory`.

Since: 0.2.6.0

findExecutable :: MonadIO m => String -> m (Maybe FilePath) Source #

Lifted `findExecutable`.

Since: 0.2.6.0

findExecutables :: MonadIO m => String -> m [FilePath] Source #

Lifted `findExecutables`.

Since: 0.2.6.0

findExecutablesInDirectories :: MonadIO m => [FilePath] -> String -> m [FilePath] Source #

Lifted `findExecutablesInDirectories`.

Since: 0.2.6.0

findFile :: MonadIO m => [FilePath] -> String -> m (Maybe FilePath) Source #

Lifted `findFile`.

Since: 0.2.6.0

findFiles :: MonadIO m => [FilePath] -> String -> m [FilePath] Source #

Lifted `findFiles`.

Since: 0.2.6.0

findFileWith :: MonadUnliftIO m => (FilePath -> m Bool) -> [FilePath] -> String -> m (Maybe FilePath) Source #

Unlifted `findFileWith`.

Since: 0.2.6.0

findFilesWith :: MonadUnliftIO m => (FilePath -> m Bool) -> [FilePath] -> String -> m [FilePath] Source #

Unlifted `findFilesWith`.

Since: 0.2.6.0

exeExtension :: String Source #

Filename extension for executable files (including the dot if any) (usually `""` on POSIX systems and `".exe"` on Windows or OS/2).

Since: directory-1.2.4.0

getFileSize :: MonadIO m => FilePath -> m Integer Source #

Lifted `getFileSize`.

Since: 0.2.6.0

# Existence tests

doesPathExist :: MonadIO m => FilePath -> m Bool Source #

Lifted `doesPathExist`.

Since: 0.2.6.0

doesFileExist :: MonadIO m => FilePath -> m Bool Source #

Lifted `doesFileExist`.

Since: 0.2.6.0

doesDirectoryExist :: MonadIO m => FilePath -> m Bool Source #

Lifted `doesDirectoryExist`.

Since: 0.2.6.0

# Symbolic links

pathIsSymbolicLink :: MonadIO m => FilePath -> m Bool Source #

Lifted `pathIsSymbolicLink`.

Since: 0.2.6.0

# Permissions

data Permissions Source #

Instances

Eq Permissions |
Instance details Defined in System.Directory.Internal.Common Methods (==) :: Permissions -> Permissions -> Bool Source # (/=) :: Permissions -> Permissions -> Bool Source #
Ord Permissions |

Instance details

Defined in System.Directory.Internal.Common

Methods

compare :: Permissions -> Permissions -> Ordering Source #

(<) :: Permissions -> Permissions -> Bool Source #

(<=) :: Permissions -> Permissions -> Bool Source #

(>) :: Permissions -> Permissions -> Bool Source #

(>=) :: Permissions -> Permissions -> Bool Source #

max :: Permissions -> Permissions -> Permissions Source #

min :: Permissions -> Permissions -> Permissions Source #

Read Permissions |
Instance details Defined in System.Directory.Internal.Common Methods readsPrec :: Int -> ReadS Permissions Source # readList :: ReadS [Permissions] Source # readPrec :: ReadPrec Permissions Source # readListPrec :: ReadPrec [Permissions] Source #
Show Permissions |
Instance details Defined in System.Directory.Internal.Common Methods showsPrec :: Int -> Permissions -> ShowS Source # show :: Permissions -> String Source # showList :: [Permissions] -> ShowS Source #

emptyPermissions :: Permissions Source #

readable :: Permissions -> Bool Source #

writable :: Permissions -> Bool Source #

executable :: Permissions -> Bool Source #

searchable :: Permissions -> Bool Source #

setOwnerReadable :: Bool -> Permissions -> Permissions Source #

setOwnerWritable :: Bool -> Permissions -> Permissions Source #

setOwnerExecutable :: Bool -> Permissions -> Permissions Source #

setOwnerSearchable :: Bool -> Permissions -> Permissions Source #

getPermissions :: MonadIO m => FilePath -> m Permissions Source #

Lifted `getPermissions`.

Since: 0.2.6.0

setPermissions :: MonadIO m => FilePath -> Permissions -> m () Source #

Lifted `setPermissions`.

Since: 0.2.6.0

copyPermissions :: MonadIO m => FilePath -> FilePath -> m () Source #

Lifted `copyPermissions`.

Since: 0.2.6.0

# Timestamps

getAccessTime :: MonadIO m => FilePath -> m UTCTime Source #

Lifted `getAccessTime`.

Since: 0.2.6.0

getModificationTime :: MonadIO m => FilePath -> m UTCTime Source #

Lifted `getModificationTime`.

Since: 0.2.6.0

setAccessTime :: MonadIO m => FilePath -> UTCTime -> m () Source #

Lifted `setAccessTime`.

Since: 0.2.6.0

setModificationTime :: MonadIO m => FilePath -> UTCTime -> m () Source #

Lifted `setModificationTime`.

Since: 0.2.6.0