hsep -base
Add a trailing file path separator if one is not already present.
> hasTrailingPathSeparator (addTrailingPathSeparator x)
> hasTrailingPathSeparator x ==> addTrailingPathSeparator x == x
> Posix: addTrailingPathSeparator "test/rest" == "test/rest/"
Remove any trailing path separators
> dropTrailingPathSeparator "file/test/" == "file/test"
> Posix: not (hasTrailingPathSeparator (dropTrailingPathSeparator x)) || isDrive x
> Posix: dropTrailingPathSeparator "/" == "/"
> Windows: dropTrailingPathSeparator "\\" == "\\"
Is an item either a directory or the last character a path separator?
> hasTrailingPathSeparator "test" == False
> hasTrailingPathSeparator "test/" == True
Rather than using (== pathSeparator), use this. Test if something is a path separator.
> isPathSeparator a == (a `elem` pathSeparators)
Is the character a file separator?
> isSearchPathSeparator a == (a == searchPathSeparator)
The character that separates directories. In the case one character is possible, pathSeparator is the 'ideal' one.
> Windows: pathSeparator == '\\'
> Posix: pathSeparator == '/'
> isPathSeparator pathSeparator
The list of all possible separators.
> Windows: pathSeparators == ['\\', '/']
> Posix: pathSeparators == ['/']
> pathSeparator `elem` pathSeparators
The character that is used to separate the entries in the $PATH environment variable.
> Windows: searchPathSeparator == ';'
> Posix: searchPathSeparator == ':'