Safe Haskell | None |
---|
A module for FilePath
operations, to be used instead of System.FilePath
when writing build systems. In build systems, when using the file name
as a key for indexing rules, it is important that two different strings do
not refer to the same on-disk file. We therefore follow the conventions:
- module System.FilePath.Posix
- module System.FilePath
- dropDirectory1 :: FilePath -> FilePath
- takeDirectory1 :: FilePath -> FilePath
- normalise :: FilePath -> FilePath
- (-<.>) :: FilePath -> String -> FilePath
- toNative :: FilePath -> FilePath
- (</>) :: FilePath -> FilePath -> FilePath
- combine :: FilePath -> FilePath -> FilePath
- exe :: String
Documentation
module System.FilePath.Posix
module System.FilePath
dropDirectory1 :: FilePath -> FilePathSource
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 -> FilePathSource
Take the first component of a FilePath
. Should only be used on
relative paths.
takeDirectory1 "aaa/bbb" == "aaa" takeDirectory1 "aaa/" == "aaa" takeDirectory1 "aaa" == "aaa"
normalise :: FilePath -> FilePathSource
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 -> FilePathSource
Remove the current extension and add another, an alias for replaceExtension
.