system-filepath-0.1.1: High-level, byte-based file and directory path manipulations

Portabilityportable
Maintainerjmillikin@gmail.com

System.FilePath

Contents

Description

High-level, byte-based file and directory path manipulations. You probably want to import System.FilePath.CurrentOS instead, since it handles detecting which rules to use in the current compilation.

Synopsis

Documentation

empty :: FilePathSource

A file path with no root, components, or filename

Basic properties

null :: FilePath -> BoolSource

null p == (p == empty)

root :: FilePath -> FilePathSource

Retrieves the FilePath's root.

directory :: FilePath -> FilePathSource

Retrieves the FilePath's directory. If the path is already a directory, it is returned unchanged.

parent :: FilePath -> FilePathSource

Retrieves the FilePath's parent directory.

filename :: FilePath -> FilePathSource

Retrieve the filename component of a FilePath. filename "foo/bar.txt" == "bar.txt".

basename :: FilePath -> FilePathSource

Retrieve the basename component of a FilePath. filename "foo/bar.txt" == "bar".

absolute :: FilePath -> BoolSource

Return whether the path is absolute.

relative :: FilePath -> BoolSource

Return whether the path is relative.

Basic operations

append :: FilePath -> FilePath -> FilePathSource

Appends two FilePaths. If the second path is absolute, it is returned unchanged.

concat :: [FilePath] -> FilePathSource

A fold over append.

commonPrefix :: [FilePath] -> FilePathSource

Find the greatest common prefix between two FilePaths.

Extensions

extension :: FilePath -> Maybe ByteStringSource

Get a FilePath's last extension, or Nothing if it has no extensions.

extensions :: FilePath -> [ByteString]Source

Get a FilePath's full extension list.

hasExtension :: FilePath -> ByteString -> BoolSource

Get whether a FilePath's last extension is the predicate.

addExtension :: FilePath -> ByteString -> FilePathSource

Append an extension to the end of a FilePath.

dropExtension :: FilePath -> FilePathSource

Remove a FilePath's last extension.

replaceExtension :: FilePath -> ByteString -> FilePathSource

Replace a FilePath's last extension.

addExtensions :: FilePath -> [ByteString] -> FilePathSource

Append many extensions to the end of a FilePath.

dropExtensions :: FilePath -> FilePathSource

Remove all extensions from a FilePath.

replaceExtensions :: FilePath -> [ByteString] -> FilePathSource

Remove all extensions from a FilePath, and replace them with a new list.