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.

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.

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.

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.

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)

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)

expandDots :: [FilePath] -> [FilePath] Source #

Given a list of path segments, expand . and ... The path segments must not contain path separators.

expandDots :: [FilePath] -> [FilePath] Source #

Given a list of path segments, expand . and ... The path segments must not contain path separators.

normaliseTrailingSep :: FilePath -> FilePath Source #

Remove redundant trailing slashes and pick the right kind of slash.

normaliseTrailingSep :: FilePath -> FilePath Source #

Remove redundant trailing slashes and pick the right kind of slash.

normaliseW :: FilePath -> FilePath Source #

A variant of normalise to handle Windows paths a little better. It

  • deduplicates trailing slashes after the drive,
  • expands parent dirs (..), and
  • preserves paths with \\?\.

normaliseW :: FilePath -> FilePath Source #

A variant of normalise to handle Windows paths a little better. It

  • deduplicates trailing slashes after the drive,
  • expands parent dirs (..), and
  • preserves paths with \\?\.

toNormalisedExtendedLengthPath :: FilePath -> FilePath Source #

Like toExtendedLengthPath but normalises relative paths too. This is needed to make sure e.g. getModificationTime works on empty paths.

toNormalisedExtendedLengthPath :: FilePath -> FilePath Source #

Like toExtendedLengthPath but normalises relative paths too. This is needed to make sure e.g. getModificationTime works on empty paths.

normaliseSeparators :: FilePath -> FilePath Source #

Normalise the path separators and prepend the "\\?\" prefix if necessary or possible. This is used for symbolic links targets because they can't handle forward slashes.

normaliseSeparators :: FilePath -> FilePath Source #

Normalise the path separators and prepend the "\\?\" prefix if necessary or possible. This is used for symbolic links targets because they can't handle forward slashes.

toExtendedLengthPath :: FilePath -> FilePath Source #

Add the "\\?\" prefix if necessary or possible. The path remains unchanged if the prefix is not added. This function can sometimes be used to bypass the MAX_PATH length restriction in Windows API calls.

toExtendedLengthPath :: FilePath -> FilePath Source #

Add the "\\?\" prefix if necessary or possible. The path remains unchanged if the prefix is not added. This function can sometimes be used to bypass the MAX_PATH length restriction in Windows API calls.

fromExtendedLengthPath :: FilePath -> FilePath Source #

Strip the "\\?\" prefix if possible. The prefix is kept if the meaning of the path would otherwise change.

fromExtendedLengthPath :: FilePath -> FilePath Source #

Strip the "\\?\" prefix if possible. The prefix is kept if the meaning of the path would otherwise change.

windowsPosixEpochDifference :: Num a => a Source #

Difference between the Windows and POSIX epochs in units of 100ns.

windowsPosixEpochDifference :: Num a => a Source #

Difference between the Windows and POSIX epochs in units of 100ns.

windowsToPosixTime :: FILETIME -> POSIXTime Source #

Convert from Windows time to POSIX time.

windowsToPosixTime :: FILETIME -> POSIXTime Source #

Convert from Windows time to POSIX time.

posixToWindowsTime :: POSIXTime -> FILETIME Source #

Convert from POSIX time to Windows time. This is lossy as Windows time has a resolution of only 100ns.

posixToWindowsTime :: POSIXTime -> FILETIME Source #

Convert from POSIX time to Windows time. This is lossy as Windows time has a resolution of only 100ns.

setFilePermissions :: FilePath -> Mode -> IO () Source #

A restricted form of setFileMode that only sets the permission bits. For Windows, this means only the "read-only" attribute is affected.

setFilePermissions :: FilePath -> Mode -> IO () Source #

A restricted form of setFileMode that only sets the permission bits. For Windows, this means only the "read-only" attribute is affected.