| Portability | portable | 
|---|---|
| Maintainer | jmillikin@gmail.com | 
Filesystem.Path
Description
High‐level, byte‐based file and directory path manipulations. You probably want to import Filesystem.Path.CurrentOS instead, since it handles detecting which rules to use in the current compilation.
- data FilePath
 - empty :: FilePath
 - null :: FilePath -> Bool
 - root :: FilePath -> FilePath
 - directory :: FilePath -> FilePath
 - parent :: FilePath -> FilePath
 - filename :: FilePath -> FilePath
 - dirname :: FilePath -> FilePath
 - basename :: FilePath -> FilePath
 - absolute :: FilePath -> Bool
 - relative :: FilePath -> Bool
 - append :: FilePath -> FilePath -> FilePath
 - (</>) :: FilePath -> FilePath -> FilePath
 - concat :: [FilePath] -> FilePath
 - commonPrefix :: [FilePath] -> FilePath
 - stripPrefix :: FilePath -> FilePath -> Maybe FilePath
 - collapse :: FilePath -> FilePath
 - extension :: FilePath -> Maybe Text
 - extensions :: FilePath -> [Text]
 - hasExtension :: FilePath -> Text -> Bool
 - addExtension :: FilePath -> Text -> FilePath
 - (<.>) :: FilePath -> Text -> FilePath
 - dropExtension :: FilePath -> FilePath
 - replaceExtension :: FilePath -> Text -> FilePath
 - addExtensions :: FilePath -> [Text] -> FilePath
 - dropExtensions :: FilePath -> FilePath
 - replaceExtensions :: FilePath -> [Text] -> FilePath
 - splitExtension :: FilePath -> (FilePath, Maybe Text)
 - splitExtensions :: FilePath -> (FilePath, [Text])
 
Documentation
Basic properties
directory :: FilePath -> FilePathSource
Retrieves the FilePath’s directory. If the path is already a
 directory, it is returned unchanged.
filename :: FilePath -> FilePathSource
Retrieve a FilePath’s filename component.
filename "foo/bar.txt" == "bar.txt"
dirname :: FilePath -> FilePathSource
Retrieve a FilePath’s directory name. This is only the
 file name of the directory, not its full path.
dirname "foobarbaz.txt" == "bar" dirname "/" == ""
Since: 0.4.1
basename :: FilePath -> FilePathSource
Retrieve a FilePath’s basename component.
basename "foo/bar.txt" == "bar"
Basic operations
append :: FilePath -> FilePath -> FilePathSource
Appends two FilePaths. If the second path is absolute, it is returned
 unchanged.
commonPrefix :: [FilePath] -> FilePathSource
Find the greatest common prefix between a list of FilePaths.
collapse :: FilePath -> FilePathSource
Remove "." and ".." directories from a path.
Note that if any of the elements are symbolic links, collapse may change
 which file the path resolves to.
Since: 0.2
Extensions
extensions :: FilePath -> [Text]Source
Get a FilePath’s full extension list.
hasExtension :: FilePath -> Text -> BoolSource
Get whether a FilePath’s last extension is the predicate.
dropExtension :: FilePath -> FilePathSource
Remove a FilePath’s last extension.
addExtensions :: FilePath -> [Text] -> FilePathSource
Append many extensions to the end of a FilePath.
dropExtensions :: FilePath -> FilePathSource
Remove all extensions from a FilePath.
replaceExtensions :: FilePath -> [Text] -> FilePathSource
Remove all extensions from a FilePath, and replace them with a new
 list.
splitExtension :: FilePath -> (FilePath, Maybe Text)Source
splitExtension p = (dropExtensionp,extensionp)
splitExtensions :: FilePath -> (FilePath, [Text])Source
splitExtensions p = (dropExtensionsp,extensionsp)