Cabal-3.10.1.0: A framework for packaging Haskell software

Safe Haskell | Safe-Inferred
Language | Haskell2010

Distribution.Compat.Directory

Synopsis

- listDirectory :: FilePath -> IO [FilePath]
- makeAbsolute :: FilePath -> IO FilePath
- doesPathExist :: FilePath -> IO Bool

# Documentation

listDirectory :: FilePath -> IO [FilePath] Source #

``listDirectory` dir` returns a list of all entries in dir without the special entries (`.` and `..`).

The operation may fail with:

- `HardwareFault` A physical I/O error has occurred. `[EIO]`
- `InvalidArgument` The operand is not a valid directory name. `[ENAMETOOLONG, ELOOP]`
- `isDoesNotExistError` The directory does not exist. `[ENOENT, ENOTDIR]`
- `isPermissionError` The process has insufficient privileges to perform the operation. `[EACCES]`
- `isFullError` Insufficient resources are available to perform the operation. `[EMFILE, ENFILE]`
- `InappropriateType` The path refers to an existing non-directory object. `[ENOTDIR]`

Since: directory-1.2.5.0

makeAbsolute :: FilePath -> IO FilePath Source #

Convert a path into an absolute path. If the given path is relative, the current directory is prepended and then the combined result is normalized. If the path is already absolute, the path is simply normalized. The function preserves the presence or absence of the trailing path separator unless the path refers to the root directory `/`.

If the path is already absolute, the operation never fails. Otherwise, the operation may fail with the same exceptions as `getCurrentDirectory`.

Since: directory-1.2.2.0

doesPathExist :: FilePath -> IO Bool Source #

Test whether the given path points to an existing filesystem object. If the user lacks necessary permissions to search the parent directories, this function may return false even if the file does actually exist.

Since: directory-1.2.7.0