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

Safe Haskell | None
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 ()
- createFileLink :: MonadIO m => FilePath -> FilePath -> m ()
- createDirectoryLink :: MonadIO m => FilePath -> FilePath -> m ()
- removeDirectoryLink :: MonadIO m => FilePath -> m ()
- getSymbolicLinkTarget :: MonadIO m => FilePath -> m FilePath
- 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
  - | XdgState
- getXdgDirectory :: MonadIO m => XdgDirectory -> FilePath -> m FilePath
- data XdgDirectoryList
  - = XdgDataDirs
  - | XdgConfigDirs
- getXdgDirectoryList :: MonadIO m => XdgDirectoryList -> 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 () #

Lifted `createDirectory`.

Since: 0.2.6.0

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

Lifted `createDirectoryIfMissing`.

Since: 0.2.6.0

createFileLink #

Arguments

:: MonadIO m |
=> FilePath | path to the target file
-> FilePath | path of the link to be created
-> m () |

Lifted `createFileLink`. directory package version should be >= 1.3.1. @since 0.2.16.0

createDirectoryLink :: MonadIO m => FilePath -> FilePath -> m () #

Lifted `createDirectoryLink`.

Since: 0.2.21.0

removeDirectoryLink :: MonadIO m => FilePath -> m () #

Lifted `removeDirectoryLink`.

Since: 0.2.21.0

getSymbolicLinkTarget :: MonadIO m => FilePath -> m FilePath #

Lifted `getSymbolicLinkTarget`.

Since: 0.2.21.0

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

Lifted `removeDirectory`.

Since: 0.2.6.0

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

Lifted `removeDirectoryRecursive`.

Since: 0.2.6.0

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

Lifted `removePathForcibly`.

Since: 0.2.6.0

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

Lifted `renameDirectory`.

Since: 0.2.6.0

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

Lifted `listDirectory`.

Since: 0.2.6.0

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

Lifted `getDirectoryContents`.

Since: 0.2.6.0

## Current working directory

getCurrentDirectory :: MonadIO m => m FilePath #

Lifted `getCurrentDirectory`.

Since: 0.2.6.0

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

Lifted `setCurrentDirectory`.

Since: 0.2.6.0

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

Unlifted `withCurrentDirectory`.

Since: 0.2.6.0

# Pre-defined directories

getHomeDirectory :: MonadIO m => m FilePath #

Lifted `getHomeDirectory`.

Since: 0.2.6.0

data XdgDirectory #

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` usually map to the same directory.

Since: directory-1.2.3.0

Constructors

XdgData | For data files (e.g. images). It uses the `XDG_DATA_HOME` environment variable. On non-Windows systems, the default is `~/.local/share`. On Windows, the default is `%APPDATA%` (e.g. `C:/Users/<user>/AppData/Roaming`). Can be considered as the user-specific equivalent of `/usr/share`.
XdgConfig | For configuration files. It uses the `XDG_CONFIG_HOME` environment variable. On non-Windows systems, the default is `~/.config`. On Windows, the default 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). It uses the `XDG_CACHE_HOME` environment variable. On non-Windows systems, the default is `~/.cache`. On Windows, the default is `%LOCALAPPDATA%` (e.g. `C:/Users/<user>/AppData/Local`). Can be considered as the user-specific equivalent of `/var/cache`.
XdgState | For data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in `XdgData`. It uses the `XDG_STATE_HOME` environment variable. On non-Windows sytems, the default is `~/.local/state`. On Windows, the default is `%LOCALAPPDATA%` (e.g. `C:/Users/<user>/AppData/Local`). Since: directory-1.3.7.0

#### Instances

Instances details

Bounded XdgDirectory |
Instance details Defined in System.Directory.Internal.Common Methods minBound :: XdgDirectory # maxBound :: XdgDirectory #
Enum XdgDirectory |
Instance details Defined in System.Directory.Internal.Common Methods succ :: XdgDirectory -> XdgDirectory # pred :: XdgDirectory -> XdgDirectory # toEnum :: Int -> XdgDirectory # fromEnum :: XdgDirectory -> Int # enumFrom :: XdgDirectory -> [XdgDirectory] # enumFromThen :: XdgDirectory -> XdgDirectory -> [XdgDirectory] # enumFromTo :: XdgDirectory -> XdgDirectory -> [XdgDirectory] # enumFromThenTo :: XdgDirectory -> XdgDirectory -> XdgDirectory -> [XdgDirectory] #
Read XdgDirectory |
Instance details Defined in System.Directory.Internal.Common Methods readsPrec :: Int -> ReadS XdgDirectory # readList :: ReadS [XdgDirectory] # readPrec :: ReadPrec XdgDirectory # readListPrec :: ReadPrec [XdgDirectory] #
Show XdgDirectory |
Instance details Defined in System.Directory.Internal.Common Methods showsPrec :: Int -> XdgDirectory -> ShowS # show :: XdgDirectory -> String # showList :: [XdgDirectory] -> ShowS #
Eq XdgDirectory |
Instance details Defined in System.Directory.Internal.Common Methods (==) :: XdgDirectory -> XdgDirectory -> Bool # (/=) :: XdgDirectory -> XdgDirectory -> Bool #
Ord XdgDirectory |
Instance details Defined in System.Directory.Internal.Common Methods compare :: XdgDirectory -> XdgDirectory -> Ordering # (<) :: XdgDirectory -> XdgDirectory -> Bool # (<=) :: XdgDirectory -> XdgDirectory -> Bool # (>) :: XdgDirectory -> XdgDirectory -> Bool # (>=) :: XdgDirectory -> XdgDirectory -> Bool # max :: XdgDirectory -> XdgDirectory -> XdgDirectory # min :: XdgDirectory -> XdgDirectory -> XdgDirectory #

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

Lifted `getXdgDirectory`.

Since: 0.2.6.0

data XdgDirectoryList #

Search paths for various application data, as specified by the XDG Base Directory Specification.

The list of paths is split using `searchPathSeparator`, which on Windows is a semicolon.

Note: On Windows, `XdgDataDirs` and `XdgConfigDirs` usually yield the same result.

Since: directory-1.3.2.0

Constructors

XdgDataDirs | For data files (e.g. images). It uses the `XDG_DATA_DIRS` environment variable. On non-Windows systems, the default is `/usr/local/share/` and `/usr/share/`. On Windows, the default is `%PROGRAMDATA%` or `%ALLUSERSPROFILE%` (e.g. `C:/ProgramData`).
XdgConfigDirs | For configuration files. It uses the `XDG_CONFIG_DIRS` environment variable. On non-Windows systems, the default is `/etc/xdg`. On Windows, the default is `%PROGRAMDATA%` or `%ALLUSERSPROFILE%` (e.g. `C:/ProgramData`).

#### Instances

Instances details

Bounded XdgDirectoryList |
Instance details Defined in System.Directory.Internal.Common Methods minBound :: XdgDirectoryList # maxBound :: XdgDirectoryList #
Enum XdgDirectoryList |
Instance details Defined in System.Directory.Internal.Common Methods succ :: XdgDirectoryList -> XdgDirectoryList # pred :: XdgDirectoryList -> XdgDirectoryList # toEnum :: Int -> XdgDirectoryList # fromEnum :: XdgDirectoryList -> Int # enumFrom :: XdgDirectoryList -> [XdgDirectoryList] # enumFromThen :: XdgDirectoryList -> XdgDirectoryList -> [XdgDirectoryList] # enumFromTo :: XdgDirectoryList -> XdgDirectoryList -> [XdgDirectoryList] # enumFromThenTo :: XdgDirectoryList -> XdgDirectoryList -> XdgDirectoryList -> [XdgDirectoryList] #
Read XdgDirectoryList |
Instance details Defined in System.Directory.Internal.Common Methods readsPrec :: Int -> ReadS XdgDirectoryList # readList :: ReadS [XdgDirectoryList] # readPrec :: ReadPrec XdgDirectoryList # readListPrec :: ReadPrec [XdgDirectoryList] #
Show XdgDirectoryList |
Instance details Defined in System.Directory.Internal.Common Methods showsPrec :: Int -> XdgDirectoryList -> ShowS # show :: XdgDirectoryList -> String # showList :: [XdgDirectoryList] -> ShowS #
Eq XdgDirectoryList |
Instance details Defined in System.Directory.Internal.Common Methods (==) :: XdgDirectoryList -> XdgDirectoryList -> Bool # (/=) :: XdgDirectoryList -> XdgDirectoryList -> Bool #
Ord XdgDirectoryList |
Instance details Defined in System.Directory.Internal.Common Methods compare :: XdgDirectoryList -> XdgDirectoryList -> Ordering # (<) :: XdgDirectoryList -> XdgDirectoryList -> Bool # (<=) :: XdgDirectoryList -> XdgDirectoryList -> Bool # (>) :: XdgDirectoryList -> XdgDirectoryList -> Bool # (>=) :: XdgDirectoryList -> XdgDirectoryList -> Bool # max :: XdgDirectoryList -> XdgDirectoryList -> XdgDirectoryList # min :: XdgDirectoryList -> XdgDirectoryList -> XdgDirectoryList #

getXdgDirectoryList :: MonadIO m => XdgDirectoryList -> m [FilePath] #

Lifted `getXdgDirectoryList`.

Since: 0.2.21.0

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

Lifted `getAppUserDataDirectory`.

Since: 0.2.6.0

getUserDocumentsDirectory :: MonadIO m => m FilePath #

Lifted `getUserDocumentsDirectory`.

Since: 0.2.6.0

getTemporaryDirectory :: MonadIO m => m FilePath #

Lifted `getTemporaryDirectory`.

Since: 0.2.6.0

# Actions on files

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

Lifted `removeFile`.

Since: 0.2.6.0

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

Lifted `renameFile`.

Since: 0.2.6.0

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

Lifted `renamePath`.

Since: 0.2.6.0

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

Lifted `copyFile`.

Since: 0.2.6.0

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

Lifted `copyFileWithMetadata`.

Since: 0.2.6.0

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

Lifted `canonicalizePath`.

Since: 0.2.6.0

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

Lifted `makeAbsolute`.

Since: 0.2.6.0

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

Lifted `makeRelativeToCurrentDirectory`.

Since: 0.2.6.0

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

Lifted `findExecutable`.

Since: 0.2.6.0

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

Lifted `findExecutables`.

Since: 0.2.6.0

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

Lifted `findExecutablesInDirectories`.

Since: 0.2.6.0

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

Lifted `findFile`.

Since: 0.2.6.0

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

Lifted `findFiles`.

Since: 0.2.6.0

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

Unlifted `findFileWith`.

Since: 0.2.6.0

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

Unlifted `findFilesWith`.

Since: 0.2.6.0

exeExtension :: String #

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 #

Lifted `getFileSize`.

Since: 0.2.6.0

# Existence tests

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

Lifted `doesPathExist`.

Since: 0.2.6.0

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

Lifted `doesFileExist`.

Since: 0.2.6.0

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

Lifted `doesDirectoryExist`.

Since: 0.2.6.0

# Symbolic links

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

Lifted `pathIsSymbolicLink`.

Since: 0.2.6.0

# Permissions

data Permissions #

#### Instances

Instances details

Read Permissions |
Instance details Defined in System.Directory.Internal.Common Methods readsPrec :: Int -> ReadS Permissions # readList :: ReadS [Permissions] # readPrec :: ReadPrec Permissions # readListPrec :: ReadPrec [Permissions] #
Show Permissions |
Instance details Defined in System.Directory.Internal.Common Methods showsPrec :: Int -> Permissions -> ShowS # show :: Permissions -> String # showList :: [Permissions] -> ShowS #
Eq Permissions |
Instance details Defined in System.Directory.Internal.Common Methods (==) :: Permissions -> Permissions -> Bool # (/=) :: Permissions -> Permissions -> Bool #
Ord Permissions |
Instance details Defined in System.Directory.Internal.Common Methods compare :: Permissions -> Permissions -> Ordering # (<) :: Permissions -> Permissions -> Bool # (<=) :: Permissions -> Permissions -> Bool # (>) :: Permissions -> Permissions -> Bool # (>=) :: Permissions -> Permissions -> Bool # max :: Permissions -> Permissions -> Permissions # min :: Permissions -> Permissions -> 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 #

Lifted `getPermissions`.

Since: 0.2.6.0

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

Lifted `setPermissions`.

Since: 0.2.6.0

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

Lifted `copyPermissions`.

Since: 0.2.6.0

# Timestamps

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

Lifted `getAccessTime`.

Since: 0.2.6.0

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

Lifted `getModificationTime`.

Since: 0.2.6.0

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

Lifted `setAccessTime`.

Since: 0.2.6.0

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

Lifted `setModificationTime`.

Since: 0.2.6.0