directory-1.3.1.5: Platform-agnostic library for filesystem operations

Stabilityunstable
Portabilityunportable
Safe HaskellSafe
LanguageHaskell2010

System.Directory.Internal

Description

Internal modules are always subject to change from version to version. The contents of this module are also platform-dependent, hence what is shown in the Hackage documentation may differ from what is actually available on your system.

Synopsis

Documentation

tryIOErrorType :: (IOError -> Bool) -> IO a -> IO (Either IOError a) Source #

Similar to try but only catches a specify kind of IOError as specified by the predicate.

data FileType Source #

Constructors

File 
SymbolicLink

POSIX: either file or directory link; Windows: file link

Directory 
DirectoryLink

Windows only

fileTypeIsDirectory :: FileType -> Bool Source #

Check whether the given FileType is considered a directory by the operating system. This affects the choice of certain functions e.g. removeDirectory vs removeFile.

getCurrentDirectory :: IO FilePath Source #

Obtain the current working directory as an absolute path.

In a multithreaded program, the current working directory is a global state shared among all threads of the process. Therefore, when performing filesystem operations from multiple threads, it is highly recommended to use absolute rather than relative paths (see: makeAbsolute).

The operation may fail with:

  • HardwareFault A physical I/O error has occurred. [EIO]
  • isDoesNotExistError or NoSuchThing There is no path referring to the working directory. [EPERM, ENOENT, ESTALE...]
  • isPermissionError or PermissionDenied The process has insufficient privileges to perform the operation. [EACCES]
  • ResourceExhausted Insufficient resources are available to perform the operation.
  • UnsupportedOperation The operating system has no notion of current working directory.

prependCurrentDirectory :: FilePath -> IO FilePath Source #

Convert a path into an absolute path. If the given path is relative, the current directory is prepended. If the path is already absolute, the path is returned unchanged. The function preserves the presence or absence of the trailing path separator.

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

(internal API)

c_free :: Ptr a -> IO () Source #