| Stability | unstable |
|---|---|
| Portability | unportable |
| Safe Haskell | Safe-Inferred |
| 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
- data FileType
- data XdgDirectory
- data XdgDirectoryList
- data Permissions = Permissions {
- readable :: Bool
- writable :: Bool
- executable :: Bool
- searchable :: Bool
- newtype ListT m a = ListT {}
- os :: String -> OsString
- 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
- rightOrError :: Exception e => Either e a -> a
- so :: OsString -> String
- ioeSetOsPath :: IOError -> OsPath -> IOError
- expandDots :: [OsPath] -> [OsPath]
- normalisePathSeps :: OsPath -> OsPath
- normaliseTrailingSep :: OsPath -> OsPath
- emptyToCurDir :: OsPath -> OsPath
- simplifyPosix :: OsPath -> OsPath
- simplifyWindows :: OsPath -> OsPath
- fileTypeIsDirectory :: FileType -> Bool
- fileTypeIsLink :: FileType -> Bool
- withBinaryHandle :: IO Handle -> (Handle -> IO r) -> IO r
- copyHandleData :: Handle -> Handle -> IO ()
- type OsPath = OsString
- data OsString
- createDirectoryInternal :: OsPath -> IO ()
- removePathInternal :: Bool -> OsPath -> IO ()
- renamePathInternal :: OsPath -> OsPath -> IO ()
- filesAlwaysRemovable :: Bool
- copyFileWithMetadataInternal :: (Metadata -> OsPath -> IO ()) -> (Metadata -> OsPath -> IO ()) -> OsPath -> OsPath -> IO ()
- win32_cSIDL_COMMON_APPDATA :: CSIDL
- win32_eRROR_ENVVAR_NOT_FOUND :: ErrCode
- 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
- maxShareMode :: ShareMode
- openFileForRead :: OsPath -> IO Handle
- possiblyOverlapped :: FileAttributeOrFlag
- win32_getFinalPathNameByHandle :: HANDLE -> DWORD -> IO WindowsPath
- c_GetFinalPathNameByHandle :: HANDLE -> Ptr CWchar -> DWORD -> DWORD -> IO DWORD
- getFinalPathName :: OsPath -> IO OsPath
- 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 :: OsPath -> IO OsPath
- simplify :: OsPath -> OsPath
- normaliseSeparators :: OsPath -> WindowsPath
- toExtendedLengthPath :: OsPath -> WindowsPath
- furnishPath :: OsPath -> IO WindowsPath
- fromExtendedLengthPath :: WindowsPath -> OsPath
- saturatingDouble :: DWORD -> DWORD
- peekTStringWith :: DWORD -> (LPTSTR -> DWORD -> IO DWORD) -> IO (Either ErrCode WindowsPath)
- realPath :: OsPath -> IO OsPath
- canonicalizePathSimplify :: OsPath -> IO OsPath
- searchPathEnvForExes :: OsString -> IO (Maybe OsPath)
- findExecutablesLazyInternal :: ([OsPath] -> OsString -> ListT IO OsPath) -> OsString -> ListT IO OsPath
- exeExtensionInternal :: OsString
- getDirectoryContentsInternal :: OsPath -> IO [OsPath]
- getCurrentDirectoryInternal :: IO OsPath
- getFullPathName :: OsPath -> IO OsPath
- rawPrependCurrentDirectory :: OsPath -> IO OsPath
- prependCurrentDirectory :: OsPath -> IO OsPath
- setCurrentDirectoryInternal :: OsPath -> IO ()
- createSymbolicLinkUnpriv :: WindowsPath -> WindowsPath -> Bool -> IO ()
- c_CreateSymbolicLink :: Ptr CWchar -> Ptr CWchar -> DWORD -> IO BYTE
- linkToDirectoryIsDirectory :: Bool
- createSymbolicLink :: Bool -> OsPath -> OsPath -> IO ()
- type Metadata = BY_HANDLE_FILE_INFORMATION
- getSymbolicLinkMetadata :: OsPath -> IO Metadata
- getFileMetadata :: OsPath -> 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 :: OsPath -> (Maybe POSIXTime, Maybe POSIXTime) -> IO ()
- openFileHandle :: OsString -> AccessMode -> IO HANDLE
- type Mode = FileAttributeOrFlag
- modeFromMetadata :: Metadata -> Mode
- hasWriteMode :: Mode -> Bool
- setWriteMode :: Bool -> Mode -> Mode
- setFileMode :: OsPath -> Mode -> IO ()
- setFilePermissions :: OsPath -> Mode -> IO ()
- getAccessPermissions :: OsPath -> IO Permissions
- setAccessPermissions :: OsPath -> Permissions -> IO ()
- lookupEnvOs :: OsString -> IO (Maybe OsString)
- c_GetEnvironmentVariable :: LPWSTR -> LPWSTR -> DWORD -> IO DWORD
- getFolderPath :: CSIDL -> IO OsPath
- getHomeDirectoryInternal :: IO OsPath
- getXdgDirectoryFallback :: IO OsPath -> XdgDirectory -> IO OsPath
- getXdgDirectoryListFallback :: XdgDirectoryList -> IO [OsPath]
- getAppUserDataDirectoryInternal :: OsPath -> IO OsPath
- getUserDocumentsDirectoryInternal :: IO OsPath
- getTemporaryDirectoryInternal :: IO OsPath
Documentation
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 # | |
| Read FileType Source # | |
| Show FileType Source # | |
| Eq FileType Source # | |
| Ord FileType Source # | |
Defined in System.Directory.Internal.Common | |
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 usually map to the same
directory.
Since: directory-1.2.3.0
Constructors
| XdgData | For data files (e.g. images).
It uses the |
| XdgConfig | For configuration files.
It uses the |
| XdgCache | For non-essential files (e.g. cache).
It uses the |
| XdgState | For data that should persist between (application) restarts,
but that is not important or portable enough to the user that it
should be stored in Since: directory-1.3.7.0 |
Instances
data XdgDirectoryList Source #
Search paths for various application data, as specified by the XDG Base Directory Specification.
The list of paths is split using searchPathSeparator,
which on Windows is a semicolon.
Note: On Windows, XdgDataDirs and XdgConfigDirs usually yield the same
result.
Since: directory-1.3.2.0
Constructors
| XdgDataDirs | For data files (e.g. images).
It uses the |
| XdgConfigDirs | For configuration files.
It uses the |
Instances
data Permissions Source #
Constructors
| Permissions | |
Fields
| |
Instances
| Read Permissions Source # | |
Defined in System.Directory.Internal.Common | |
| Show Permissions Source # | |
Defined in System.Directory.Internal.Common | |
| 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 # | |
A generator with side-effects.
os :: String -> OsString Source #
Fallibly converts String to OsString. Only intended to be used on literals.
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.
rightOrError :: Exception e => Either e a -> a Source #
so :: OsString -> String Source #
Fallibly converts OsString to String. Only intended to be used on literals.
expandDots :: [OsPath] -> [OsPath] Source #
Given a list of path segments, expand . and ... The path segments
must not contain path separators.
normalisePathSeps :: OsPath -> OsPath Source #
Convert to the right kind of slashes.
normaliseTrailingSep :: OsPath -> OsPath Source #
Remove redundant trailing slashes and pick the right kind of slash.
emptyToCurDir :: OsPath -> OsPath Source #
Convert empty paths to the current directory, otherwise leave it unchanged.
simplifyWindows :: OsPath -> OsPath 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.
Copy data from one handle to another until end of file.
type OsPath = OsString Source #
Type representing filenames/pathnames.
This type doesn't add any guarantees over OsString.
Newtype representing short operating system specific strings.
Internally this is either WindowsString or PosixString,
depending on the platform. Both use unpinned
ShortByteString for efficiency.
The constructor is only exported via System.OsString.Internal.Types, since dealing with the internals isn't generally recommended, but supported in case you need to write platform specific code.
Instances
| Monoid OsString | "String-Concatenation" for |
| Semigroup OsString | |
| Generic OsString | |
| Show OsString | On windows, decodes as UCS-2. On unix prints the raw bytes without decoding. |
| NFData OsString | |
Defined in System.OsString.Internal.Types.Hidden | |
| Eq OsString | Byte equality of the internal representation. |
| Ord OsString | Byte ordering of the internal representation. |
Defined in System.OsString.Internal.Types.Hidden | |
| Lift OsString | |
| type Rep OsString | |
Defined in System.OsString.Internal.Types.Hidden type Rep OsString = D1 ('MetaData "OsString" "System.OsString.Internal.Types.Hidden" "filepath-1.4.301.0" 'True) (C1 ('MetaCons "OsString" 'PrefixI 'True) (S1 ('MetaSel ('Just "getOsString") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PlatformString))) | |
createDirectoryInternal :: OsPath -> IO () Source #
copyFileWithMetadataInternal :: (Metadata -> OsPath -> IO ()) -> (Metadata -> OsPath -> IO ()) -> OsPath -> OsPath -> IO () Source #
data Win32_REPARSE_DATA_BUFFER Source #
Constructors
| Win32_MOUNT_POINT_REPARSE_DATA_BUFFER WindowsString WindowsString | substituteName printName |
| Win32_SYMLINK_REPARSE_DATA_BUFFER WindowsString WindowsString 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 #
normaliseSeparators :: OsPath -> WindowsPath 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 :: OsPath -> WindowsPath Source #
simplify the path and prepend the "\\?\" if possible. This
function can sometimes be used to bypass the MAX_PATH length restriction
in Windows API calls.
furnishPath :: OsPath -> IO WindowsPath Source #
Make a path absolute and convert to an extended length path, if possible.
Empty paths are left unchanged.
This function never fails. If it doesn't understand the path, it just returns the path unchanged.
fromExtendedLengthPath :: WindowsPath -> OsPath Source #
Strip the "\\?\" prefix if possible.
The prefix is kept if the meaning of the path would otherwise change.
saturatingDouble :: DWORD -> DWORD Source #
Arguments
| :: DWORD | |
| -> (LPTSTR -> DWORD -> IO DWORD) | Must accept a buffer and its size in TCHARs. If the buffer is large enough for the function, it must write a string to it, which need not be null-terminated, and return the length of the string, not including the null terminator if present. If the buffer is too small, it must return a proposed buffer size in TCHARs, although it need not guarantee success with the proposed size if, say, the underlying data changes in the interim. If it fails for any other reason, it must return zero and communicate the error code through GetLastError. |
| -> IO (Either ErrCode WindowsPath) |
findExecutablesLazyInternal :: ([OsPath] -> OsString -> ListT IO OsPath) -> OsString -> ListT IO OsPath Source #
rawPrependCurrentDirectory :: OsPath -> IO OsPath Source #
Similar to prependCurrentDirectory but fails for empty paths.
prependCurrentDirectory :: OsPath -> IO OsPath Source #
Convert a path into an absolute path. If the given path is relative, the current directory is prepended and the path may or may not be simplified. 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 throw exceptions.
Empty paths are treated as the current directory.
setCurrentDirectoryInternal :: OsPath -> IO () Source #
createSymbolicLinkUnpriv :: WindowsPath -> WindowsPath -> Bool -> 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 :: OsString -> 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 :: OsPath -> 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 :: OsPath -> Permissions -> IO () Source #
getXdgDirectoryFallback :: IO OsPath -> XdgDirectory -> IO OsPath Source #