Portability | portable |
---|---|
Maintainer | [email protected] |
System.FilePath.Rules
Description
- data Rules platformFormat
- posix :: Rules ByteString
- windows :: Rules Text
- toText :: Rules platformFormat -> FilePath -> Either Text Text
- fromText :: Rules platformFormat -> Text -> FilePath
- encode :: Rules platformFormat -> FilePath -> platformFormat
- decode :: Rules platformFormat -> platformFormat -> FilePath
- valid :: Rules platformFormat -> FilePath -> Bool
- splitSearchPath :: Rules platformFormat -> platformFormat -> [FilePath]
Documentation
posix :: Rules ByteStringSource
Linux, BSD, OS X, and other UNIX or UNIX-like operating systems.
Type conversions
toText :: Rules platformFormat -> 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 toBytes
and then decode
them manually.
Since: 0.2
fromText :: Rules platformFormat -> Text -> FilePathSource
Convert human‐readable text into a FilePath
.
This function ignores the user’s locale, and assumes all
file paths are encoded in UTF8. If you need to create file paths
with an unusual or obscure encoding, encode them manually and then
use fromBytes
.
Since: 0.2
encode :: Rules platformFormat -> FilePath -> platformFormatSource
Convert a FilePath
to the platform’s underlying format.
Since: 0.3
decode :: Rules platformFormat -> platformFormat -> FilePathSource
Convert the platform’s underlying format to a FilePath
.
Since: 0.3
Rule‐specific path properties
splitSearchPath :: Rules platformFormat -> platformFormat -> [FilePath]Source
Split a search path, such as $PATH
or $PYTHONPATH
, into
a list of FilePath
s.