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
- newtype ListT m a = ListT {}
- emptyListT :: Applicative m => ListT m a
- maybeToListT :: Applicative m => m (Maybe a) -> ListT m a
- listToListT :: Applicative m => [a] -> ListT m a
- liftJoinListT :: Monad m => m (ListT m a) -> ListT m a
- listTHead :: Functor m => ListT m a -> m (Maybe a)
- listTToList :: Monad m => ListT m a -> m [a]
- andM :: Monad m => m Bool -> m Bool -> m Bool
- sequenceWithIOErrors_ :: [IO ()] -> IO ()
- tryIOErrorType :: (IOError -> Bool) -> IO a -> IO (Either IOError a)
- ignoreIOExceptions :: IO () -> IO ()
- specializeErrorString :: String -> (IOError -> Bool) -> IO a -> IO a
- ioeAddLocation :: IOError -> String -> IOError
- data FileType
- fileTypeIsDirectory :: FileType -> Bool
- fileTypeIsLink :: FileType -> Bool
- data Permissions = Permissions {
- readable :: Bool
- writable :: Bool
- executable :: Bool
- searchable :: Bool
- prependCurrentDirectoryWith :: IO FilePath -> FilePath -> IO FilePath
- copyFileContents :: FilePath -> FilePath -> IO ()
- copyFileToHandle :: FilePath -> Handle -> IO ()
- copyHandleData :: Handle -> Handle -> IO ()
- data XdgDirectory
- data XdgDirectoryList
- createDirectoryInternal :: FilePath -> IO ()
- removePathInternal :: Bool -> FilePath -> IO ()
- renamePathInternal :: FilePath -> FilePath -> IO ()
- copyFileWithMetadataInternal :: (Metadata -> FilePath -> IO ()) -> (Metadata -> FilePath -> IO ()) -> FilePath -> FilePath -> IO ()
- win32_cSIDL_LOCAL_APPDATA :: CSIDL
- win32_cSIDL_COMMON_APPDATA :: CSIDL
- win32_eRROR_INVALID_FUNCTION :: ErrCode
- win32_eRROR_INVALID_PARAMETER :: ErrCode
- win32_eRROR_PRIVILEGE_NOT_HELD :: ErrCode
- win32_sYMBOLIC_LINK_FLAG_DIRECTORY :: DWORD
- win32_sYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE :: DWORD
- win32_fILE_ATTRIBUTE_REPARSE_POINT :: FileAttributeOrFlag
- win32_fILE_SHARE_DELETE :: ShareMode
- maxShareMode :: ShareMode
- win32_getLongPathName :: FilePath -> IO FilePath
- win32_getShortPathName :: FilePath -> IO FilePath
- win32_getFinalPathNameByHandle :: HANDLE -> DWORD -> IO FilePath
- c_GetFinalPathNameByHandle :: HANDLE -> Ptr CWchar -> DWORD -> DWORD -> IO DWORD
- getFinalPathName :: FilePath -> IO FilePath
- win32_fILE_FLAG_OPEN_REPARSE_POINT :: FileAttributeOrFlag
- win32_fSCTL_GET_REPARSE_POINT :: DWORD
- win32_iO_REPARSE_TAG_MOUNT_POINT :: CULong
- win32_iO_REPARSE_TAG_SYMLINK :: CULong
- win32_mAXIMUM_REPARSE_DATA_BUFFER_SIZE :: DWORD
- 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_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)
- c_DeviceIoControl :: HANDLE -> DWORD -> Ptr a -> DWORD -> Ptr b -> DWORD -> Ptr DWORD -> Ptr Void -> IO BOOL
- readSymbolicLink :: FilePath -> IO FilePath
- expandDots :: [FilePath] -> [FilePath]
- normaliseTrailingSep :: FilePath -> FilePath
- normaliseW :: FilePath -> FilePath
- toNormalisedExtendedLengthPath :: FilePath -> FilePath
- normaliseSeparators :: FilePath -> FilePath
- toExtendedLengthPath :: FilePath -> FilePath
- fromExtendedLengthPath :: FilePath -> FilePath
- getPathNameWith :: (Ptr CWchar -> DWORD -> IO DWORD) -> IO FilePath
- canonicalizePathWith :: ((FilePath -> IO FilePath) -> FilePath -> IO FilePath) -> FilePath -> IO FilePath
- canonicalizePathSimplify :: FilePath -> IO FilePath
- searchPathEnvForExes :: String -> IO (Maybe FilePath)
- findExecutablesLazyInternal :: ([FilePath] -> String -> ListT IO FilePath) -> String -> ListT IO FilePath
- exeExtensionInternal :: String
- getDirectoryContentsInternal :: FilePath -> IO [FilePath]
- getCurrentDirectoryInternal :: IO FilePath
- prependCurrentDirectory :: FilePath -> IO FilePath
- setCurrentDirectoryInternal :: FilePath -> IO ()
- createSymbolicLinkUnpriv :: String -> String -> Bool -> IO ()
- c_CreateSymbolicLink :: Ptr CWchar -> Ptr CWchar -> DWORD -> IO BYTE
- linkToDirectoryIsDirectory :: Bool
- createSymbolicLink :: Bool -> FilePath -> FilePath -> IO ()
- type Metadata = BY_HANDLE_FILE_INFORMATION
- getSymbolicLinkMetadata :: FilePath -> IO Metadata
- getFileMetadata :: FilePath -> IO Metadata
- fileTypeFromMetadata :: Metadata -> FileType
- fileSizeFromMetadata :: Metadata -> Integer
- accessTimeFromMetadata :: Metadata -> UTCTime
- modificationTimeFromMetadata :: Metadata -> UTCTime
- windowsPosixEpochDifference :: Num a => a
- windowsToPosixTime :: FILETIME -> POSIXTime
- posixToWindowsTime :: POSIXTime -> FILETIME
- setTimes :: FilePath -> (Maybe POSIXTime, Maybe POSIXTime) -> IO ()
- openFileHandle :: String -> AccessMode -> IO HANDLE
- type Mode = FileAttributeOrFlag
- modeFromMetadata :: Metadata -> Mode
- hasWriteMode :: Mode -> Bool
- setWriteMode :: Bool -> Mode -> Mode
- setFileMode :: FilePath -> Mode -> IO ()
- setFilePermissions :: FilePath -> Mode -> IO ()
- getAccessPermissions :: FilePath -> IO Permissions
- setAccessPermissions :: FilePath -> Permissions -> IO ()
- getFolderPath :: CSIDL -> IO FilePath
- getHomeDirectoryInternal :: IO FilePath
- getXdgDirectoryInternal :: IO FilePath -> XdgDirectory -> IO FilePath
- getXdgDirectoryListInternal :: XdgDirectoryList -> IO [FilePath]
- getAppUserDataDirectoryInternal :: FilePath -> IO FilePath
- getUserDocumentsDirectoryInternal :: IO FilePath
- getTemporaryDirectoryInternal :: IO FilePath
Documentation
A generator with side-effects.
emptyListT :: Applicative m => ListT m a Source #
maybeToListT :: Applicative m => m (Maybe a) -> ListT m a Source #
listToListT :: Applicative m => [a] -> ListT m a Source #
listTToList :: Monad m => ListT m a -> m [a] Source #
sequenceWithIOErrors_ :: [IO ()] -> IO () Source #
ignoreIOExceptions :: IO () -> IO () Source #
Attempt to perform the given action, silencing any IO exception thrown by it.
Constructors
File | |
SymbolicLink | POSIX: either file or directory link; Windows: file link |
Directory | |
DirectoryLink | Windows only: directory link |
Instances
Bounded FileType Source # | |
Enum FileType Source # | |
Defined in System.Directory.Internal.Common 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 Source # | |
Ord FileType Source # | |
Defined in System.Directory.Internal.Common | |
Read FileType Source # | |
Show FileType Source # | |
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 Source # | |
Defined in System.Directory.Internal.Common | |
Ord Permissions Source # | |
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 # | |
Read Permissions Source # | |
Defined in System.Directory.Internal.Common | |
Show Permissions Source # | |
Defined in System.Directory.Internal.Common |
prependCurrentDirectoryWith :: IO FilePath -> 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)
Truncate the destination file and then copy the contents of the source file to the destination file. If the destination file already exists, its attributes shall remain unchanged. Otherwise, its attributes are reset to the defaults.
Copy all data from a file to a handle.
Copy data from one handle to another until end of file.
data XdgDirectory Source #
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
map to the same directory.
Since: directory-1.2.3.0
Constructors
XdgData | For data files (e.g. images).
Defaults to |
XdgConfig | For configuration files.
Defaults to |
XdgCache | For non-essential files (e.g. cache).
Defaults to |
Instances
data XdgDirectoryList Source #
Search paths for various application data, as specified by the XDG Base Directory Specification.
Note: On Windows, XdgDataDirs
and XdgConfigDirs
yield the same result.
Since: directory-1.3.2.0
Constructors
XdgDataDirs | For data files (e.g. images).
Defaults to |
XdgConfigDirs | For configuration files.
Defaults to |
Instances
createDirectoryInternal :: FilePath -> IO () Source #
copyFileWithMetadataInternal :: (Metadata -> FilePath -> IO ()) -> (Metadata -> FilePath -> IO ()) -> FilePath -> FilePath -> IO () Source #
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_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 #
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.
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
\\?\
.
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.
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.
canonicalizePathWith :: ((FilePath -> IO FilePath) -> FilePath -> IO FilePath) -> FilePath -> IO FilePath Source #
findExecutablesLazyInternal :: ([FilePath] -> String -> ListT IO FilePath) -> String -> ListT IO FilePath Source #
setCurrentDirectoryInternal :: FilePath -> IO () Source #
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.
posixToWindowsTime :: POSIXTime -> FILETIME Source #
Convert from POSIX time to Windows time. This is lossy as Windows time has a resolution of only 100ns.
openFileHandle :: String -> AccessMode -> IO HANDLE Source #
Open the handle of an existing file or directory.
type Mode = FileAttributeOrFlag Source #
modeFromMetadata :: Metadata -> Mode 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.
setAccessPermissions :: FilePath -> Permissions -> IO () Source #
getXdgDirectoryInternal :: IO FilePath -> XdgDirectory -> IO FilePath Source #