Portability | portable |
---|---|
Maintainer | jmillikin@gmail.com |
Safe Haskell | None |
Re‐exports contents of Filesystem.Path.Rules, defaulting to the current OS’s rules when needed.
- module Filesystem.Path
- currentOS :: Rules platformTextFormat
- toText :: FilePath -> Either Text Text
- fromText :: Text -> FilePath
- encode :: FilePath -> platformTextFormat
- decode :: platformTextFormat -> FilePath
- encodeString :: FilePath -> String
- decodeString :: String -> FilePath
- valid :: FilePath -> Bool
- splitSearchPath :: platformTextFormat -> [FilePath]
- splitSearchPathString :: String -> [FilePath]
Documentation
module Filesystem.Path
Type conversions
toText :: FilePath -> Either Text TextSource
Attempt to convert a FilePath
to human‐readable text.
If the path is decoded successfully, the result is a Right
containing
the decoded text. Successfully decoded text can be converted back to the
original path using fromText
.
If the path cannot be decoded, the result is a Left
containing an
approximation of the original path. If displayed to the user, this value
should be accompanied by some warning that the path has an invalid
encoding. Approximated text cannot be converted back to the original path.
This function ignores the user’s locale, and assumes all file paths
are encoded in UTF8. If you need to display file paths with an unusual or
obscure encoding, use encode
and then decode them manually.
Since: 0.2
encode :: FilePath -> platformTextFormatSource
Convert a FilePath
to a platform‐specific format, suitable
for use with external OS functions.
Since: 0.3
decode :: platformTextFormat -> FilePathSource
Convert a FilePath
from a platform‐specific format, suitable
for use with external OS functions.
Since: 0.3
encodeString :: FilePath -> StringSource
decodeString :: String -> FilePathSource
Rule‐specific path properties
splitSearchPath :: platformTextFormat -> [FilePath]Source
Split a search path, such as $PATH
or $PYTHONPATH
, into a list
of FilePath
s.
splitSearchPathString :: String -> [FilePath]Source
splitSearchPathString is like splitSearchPath
, but takes a string
encoded in the format used by System.IO
.