Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A module for FilePath
operations exposing System.FilePath plus some additional operations.
Windows note: The extension methods (<.>
, takeExtension
etc) use the Posix variants since on
Windows "//*"
produces <.>
"txt""//*\\.txt"
(which is bad for FilePattern
values).
- module System.FilePath
- module System.FilePath.Posix
- dropDirectory1 :: FilePath -> FilePath
- takeDirectory1 :: FilePath -> FilePath
- normaliseEx :: FilePath -> FilePath
- (-<.>) :: FilePath -> String -> FilePath
- toNative :: FilePath -> FilePath
- toStandard :: FilePath -> FilePath
- exe :: String
Documentation
module System.FilePath
module System.FilePath.Posix
dropDirectory1 :: FilePath -> FilePath Source
Drop the first directory from a FilePath
. Should only be used on
relative paths.
dropDirectory1 "aaa/bbb" == "bbb" dropDirectory1 "aaa/" == "" dropDirectory1 "aaa" == "" dropDirectory1 "" == ""
takeDirectory1 :: FilePath -> FilePath Source
Take the first component of a FilePath
. Should only be used on
relative paths.
takeDirectory1 "aaa/bbb" == "aaa" takeDirectory1 "aaa/" == "aaa" takeDirectory1 "aaa" == "aaa"
normaliseEx :: FilePath -> FilePath Source
Normalise a FilePath
, trying to do:
- All
pathSeparators
become/
foo/bar/../baz
becomesfoo/baz
foo/./bar
becomesfoo/bar
foo//bar
becomesfoo/bar
This function is not based on the normalise function from the filepath library, as that function is quite broken.
(-<.>) :: FilePath -> String -> FilePath infixr 7 Source
Remove the current extension and add another, an alias for replaceExtension
.
toStandard :: FilePath -> FilePath Source
Convert all path separators to /
, even on Windows.