Copyright | © 2016 Julian Ospald |
---|---|
License | BSD3 |
Maintainer | Julian Ospald <hasufell@posteo.de> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Traversal and read operations on directories.
Synopsis
- getDirectoryContents :: RawFilePath -> IO [(DirType, RawFilePath)]
- getDirectoryContents' :: Fd -> IO [(DirType, RawFilePath)]
- allDirectoryContents :: RawFilePath -> IO [RawFilePath]
- allDirectoryContents' :: RawFilePath -> IO [RawFilePath]
- traverseDirectory :: (s -> RawFilePath -> IO s) -> s -> RawFilePath -> IO s
- readDirEnt :: DirStream -> IO (DirType, RawFilePath)
- packDirStream :: Ptr CDir -> DirStream
- unpackDirStream :: DirStream -> Ptr CDir
- fdOpendir :: Fd -> IO DirStream
- realpath :: RawFilePath -> IO RawFilePath
Documentation
getDirectoryContents :: RawFilePath -> IO [(DirType, RawFilePath)] Source #
Gets all directory contents (not recursively).
getDirectoryContents' :: Fd -> IO [(DirType, RawFilePath)] Source #
Like getDirectoryContents
except for a file descriptor.
To avoid complicated error checks, the file descriptor is
always closed, even if fdOpendir
fails. Usually, this
only happens on successful fdOpendir
and after the directory
stream is closed. Also see the manpage of fdopendir(3)
for
more details.
allDirectoryContents :: RawFilePath -> IO [RawFilePath] Source #
Get all files from a directory and its subdirectories.
Upon entering a directory, allDirectoryContents
will get all entries
strictly. However the returned list is lazy in that directories will only
be accessed on demand.
Follows symbolic links for the input dir.
allDirectoryContents' :: RawFilePath -> IO [RawFilePath] Source #
Get all files from a directory and its subdirectories strictly.
Follows symbolic links for the input dir.
traverseDirectory :: (s -> RawFilePath -> IO s) -> s -> RawFilePath -> IO s Source #
Recursively apply the action
to the parent directory and all
files/subdirectories.
This function allows for memory-efficient traversals.
Follows symbolic links for the input dir.
readDirEnt :: DirStream -> IO (DirType, RawFilePath) Source #
packDirStream :: Ptr CDir -> DirStream Source #
unpackDirStream :: DirStream -> Ptr CDir Source #
realpath :: RawFilePath -> IO RawFilePath Source #
return the canonicalized absolute pathname
like canonicalizePath, but uses realpath(3)