Stability | unstable |
---|---|
Portability | unportable |
Safe Haskell | Safe |
Language | Haskell2010 |
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
- tryIOErrorType :: (IOError -> Bool) -> IO a -> IO (Either IOError a)
- tryIOErrorType :: (IOError -> Bool) -> IO a -> IO (Either IOError a)
- specializeErrorString :: String -> (IOError -> Bool) -> IO a -> IO a
- specializeErrorString :: String -> (IOError -> Bool) -> IO a -> IO a
- ioeAddLocation :: IOError -> String -> IOError
- ioeAddLocation :: IOError -> String -> IOError
- data FileType
- fileTypeIsDirectory :: FileType -> Bool
- fileTypeIsDirectory :: FileType -> Bool
- data Permissions = Permissions {
- readable :: Bool
- writable :: Bool
- executable :: Bool
- searchable :: Bool
- getCurrentDirectory :: IO FilePath
- getCurrentDirectory :: IO FilePath
- prependCurrentDirectory :: FilePath -> IO FilePath
- prependCurrentDirectory :: FilePath -> IO FilePath
- win32_cSIDL_LOCAL_APPDATA :: CSIDL
- win32_cSIDL_LOCAL_APPDATA :: CSIDL
- win32_eRROR_INVALID_FUNCTION :: ErrCode
- win32_eRROR_INVALID_FUNCTION :: ErrCode
- win32_fILE_ATTRIBUTE_REPARSE_POINT :: FileAttributeOrFlag
- win32_fILE_ATTRIBUTE_REPARSE_POINT :: FileAttributeOrFlag
- win32_fILE_SHARE_DELETE :: ShareMode
- win32_fILE_SHARE_DELETE :: ShareMode
- maxShareMode :: ShareMode
- maxShareMode :: ShareMode
- win32_getLongPathName :: FilePath -> IO FilePath
- win32_getShortPathName :: FilePath -> IO FilePath
- win32_getLongPathName :: FilePath -> IO FilePath
- win32_getShortPathName :: FilePath -> IO FilePath
- win32_getFinalPathNameByHandle :: HANDLE -> DWORD -> IO FilePath
- win32_getFinalPathNameByHandle :: HANDLE -> DWORD -> IO FilePath
- getFinalPathName :: FilePath -> IO FilePath
- getFinalPathName :: FilePath -> IO FilePath
- win32_fILE_FLAG_OPEN_REPARSE_POINT :: FileAttributeOrFlag
- win32_fILE_FLAG_OPEN_REPARSE_POINT :: FileAttributeOrFlag
- win32_fSCTL_GET_REPARSE_POINT :: DWORD
- win32_fSCTL_GET_REPARSE_POINT :: DWORD
- win32_iO_REPARSE_TAG_MOUNT_POINT :: CULong
- win32_iO_REPARSE_TAG_SYMLINK :: CULong
- win32_iO_REPARSE_TAG_MOUNT_POINT :: CULong
- win32_iO_REPARSE_TAG_SYMLINK :: CULong
- win32_mAXIMUM_REPARSE_DATA_BUFFER_SIZE :: DWORD
- win32_mAXIMUM_REPARSE_DATA_BUFFER_SIZE :: DWORD
- win32_sYMLINK_FLAG_RELATIVE :: CULong
- win32_sYMLINK_FLAG_RELATIVE :: CULong
- data Win32_REPARSE_DATA_BUFFER
- win32_alloca_REPARSE_DATA_BUFFER :: ((Ptr Win32_REPARSE_DATA_BUFFER, Int) -> IO a) -> IO a
- win32_alloca_REPARSE_DATA_BUFFER :: ((Ptr Win32_REPARSE_DATA_BUFFER, Int) -> IO a) -> IO a
- win32_peek_REPARSE_DATA_BUFFER :: Ptr Win32_REPARSE_DATA_BUFFER -> IO Win32_REPARSE_DATA_BUFFER
- win32_peek_REPARSE_DATA_BUFFER :: Ptr Win32_REPARSE_DATA_BUFFER -> IO Win32_REPARSE_DATA_BUFFER
- deviceIoControl :: HANDLE -> DWORD -> (Ptr a, Int) -> (Ptr b, Int) -> Maybe Void -> IO (Either ErrCode Int)
- deviceIoControl :: HANDLE -> DWORD -> (Ptr a, Int) -> (Ptr b, Int) -> Maybe Void -> IO (Either ErrCode Int)
- c_DeviceIoControl :: HANDLE -> DWORD -> Ptr a -> DWORD -> Ptr b -> DWORD -> Ptr DWORD -> Ptr Void -> IO BOOL
- readSymbolicLink :: FilePath -> IO FilePath
- readSymbolicLink :: FilePath -> IO FilePath
- expandDots :: [FilePath] -> [FilePath]
- expandDots :: [FilePath] -> [FilePath]
- normaliseTrailingSep :: FilePath -> FilePath
- normaliseTrailingSep :: FilePath -> FilePath
- normaliseW :: FilePath -> FilePath
- normaliseW :: FilePath -> FilePath
- toNormalisedExtendedLengthPath :: FilePath -> FilePath
- toNormalisedExtendedLengthPath :: FilePath -> FilePath
- normaliseSeparators :: FilePath -> FilePath
- normaliseSeparators :: FilePath -> FilePath
- toExtendedLengthPath :: FilePath -> FilePath
- toExtendedLengthPath :: FilePath -> FilePath
- fromExtendedLengthPath :: FilePath -> FilePath
- fromExtendedLengthPath :: FilePath -> FilePath
- getPathNameWith :: (Ptr CWchar -> DWORD -> IO DWORD) -> IO FilePath
- getPathNameWith :: (Ptr CWchar -> DWORD -> IO DWORD) -> IO FilePath
- win32_createSymbolicLink :: String -> String -> Bool -> IO ()
- win32_createSymbolicLink :: String -> String -> Bool -> IO ()
- createSymbolicLink :: Bool -> FilePath -> FilePath -> IO ()
- createSymbolicLink :: Bool -> FilePath -> FilePath -> IO ()
- type Metadata = BY_HANDLE_FILE_INFORMATION
- getSymbolicLinkMetadata :: FilePath -> IO Metadata
- getSymbolicLinkMetadata :: FilePath -> IO Metadata
- getFileMetadata :: FilePath -> IO Metadata
- getFileMetadata :: FilePath -> IO Metadata
- fileTypeFromMetadata :: Metadata -> FileType
- fileTypeFromMetadata :: Metadata -> FileType
- fileSizeFromMetadata :: Metadata -> Integer
- fileSizeFromMetadata :: Metadata -> Integer
- accessTimeFromMetadata :: Metadata -> UTCTime
- accessTimeFromMetadata :: Metadata -> UTCTime
- modificationTimeFromMetadata :: Metadata -> UTCTime
- modificationTimeFromMetadata :: Metadata -> UTCTime
- windowsPosixEpochDifference :: Num a => a
- windowsPosixEpochDifference :: Num a => a
- windowsToPosixTime :: FILETIME -> POSIXTime
- windowsToPosixTime :: FILETIME -> POSIXTime
- posixToWindowsTime :: POSIXTime -> FILETIME
- posixToWindowsTime :: POSIXTime -> FILETIME
- type Mode = FileAttributeOrFlag
- modeFromMetadata :: Metadata -> Mode
- modeFromMetadata :: Metadata -> Mode
- hasWriteMode :: Mode -> Bool
- hasWriteMode :: Mode -> Bool
- setWriteMode :: Bool -> Mode -> Mode
- setWriteMode :: Bool -> Mode -> Mode
- setFileMode :: FilePath -> Mode -> IO ()
- setFileMode :: FilePath -> Mode -> IO ()
- setFilePermissions :: FilePath -> Mode -> IO ()
- setFilePermissions :: FilePath -> Mode -> IO ()
- getAccessPermissions :: FilePath -> IO Permissions
- getAccessPermissions :: FilePath -> IO Permissions
- setAccessPermissions :: FilePath -> Permissions -> IO ()
- setAccessPermissions :: FilePath -> Permissions -> IO ()
Documentation
Constructors
File | |
SymbolicLink | POSIX: either file or directory link; Windows: file link |
Directory | |
DirectoryLink | Windows only |
Instances
Bounded FileType # | |
Enum FileType # | |
Methods succ :: FileType -> FileType Source # pred :: FileType -> FileType Source # toEnum :: Int -> FileType Source # fromEnum :: FileType -> Int Source # enumFrom :: FileType -> [FileType] Source # enumFromThen :: FileType -> FileType -> [FileType] Source # enumFromTo :: FileType -> FileType -> [FileType] Source # enumFromThenTo :: FileType -> FileType -> FileType -> [FileType] Source # | |
Eq FileType # | |
Ord FileType # | |
Read FileType # | |
Show FileType # | |
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
.
data Permissions Source #
Constructors
Permissions | |
Fields
|
Instances
Eq Permissions # | |
Ord Permissions # | |
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 # | |
Read Permissions # | |
Show Permissions # | |
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
orNoSuchThing
There is no path referring to the working directory.[EPERM, ENOENT, ESTALE...]
isPermissionError
orPermissionDenied
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
orNoSuchThing
There is no path referring to the working directory.[EPERM, ENOENT, ESTALE...]
isPermissionError
orPermissionDenied
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)
data Win32_REPARSE_DATA_BUFFER Source #
Constructors
Win32_MOUNT_POINT_REPARSE_DATA_BUFFER String String | substituteName printName |
Win32_SYMLINK_REPARSE_DATA_BUFFER String String Bool | substituteName printName isRelative |
Win32_GENERIC_REPARSE_DATA_BUFFER |
win32_alloca_REPARSE_DATA_BUFFER :: ((Ptr Win32_REPARSE_DATA_BUFFER, Int) -> IO a) -> IO a Source #
win32_alloca_REPARSE_DATA_BUFFER :: ((Ptr Win32_REPARSE_DATA_BUFFER, Int) -> IO a) -> IO a Source #
win32_peek_REPARSE_DATA_BUFFER :: Ptr Win32_REPARSE_DATA_BUFFER -> IO Win32_REPARSE_DATA_BUFFER Source #
win32_peek_REPARSE_DATA_BUFFER :: Ptr Win32_REPARSE_DATA_BUFFER -> IO Win32_REPARSE_DATA_BUFFER Source #
deviceIoControl :: HANDLE -> DWORD -> (Ptr a, Int) -> (Ptr b, Int) -> Maybe Void -> IO (Either ErrCode Int) Source #
deviceIoControl :: HANDLE -> DWORD -> (Ptr a, Int) -> (Ptr b, Int) -> Maybe Void -> IO (Either ErrCode Int) Source #
c_DeviceIoControl :: HANDLE -> DWORD -> Ptr a -> DWORD -> Ptr b -> DWORD -> Ptr DWORD -> Ptr Void -> IO BOOL Source #
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.
type Mode = FileAttributeOrFlag Source #
modeFromMetadata :: Metadata -> Mode Source #
modeFromMetadata :: Metadata -> Mode Source #
hasWriteMode :: Mode -> Bool Source #
hasWriteMode :: Mode -> Bool Source #
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.
setAccessPermissions :: FilePath -> Permissions -> IO () Source #
setAccessPermissions :: FilePath -> Permissions -> IO () Source #