A collection of useful operations when dealing with files.
Author: Michael Hanus, Bernd Brassel
Version: June 2009
separatorChar
:: Char
The character for separating hierarchies in file names. |
pathSeparatorChar
:: Char
The character for separating names in path expressions. |
suffixSeparatorChar
:: Char
The character for separating suffixes in file names. |
isAbsolute
:: String -> Bool
Is the argument an absolute name? |
dirName
:: String -> String
Extracts the directoy prefix of a given (Unix) file name. |
baseName
:: String -> String
Extracts the base name without directoy prefix of a given (Unix) file name. |
splitDirectoryBaseName
:: String -> (String,String)
Splits a (Unix) file name into the directory prefix and the base name. |
stripSuffix
:: String -> String
Strips a suffix (the last suffix starting with a dot) from a file name. |
fileSuffix
:: String -> String
Yields the suffix (the last suffix starting with a dot) from given file name. |
splitBaseName
:: String -> (String,String)
Splits a file name into prefix and suffix (the last suffix starting with a dot and the rest). |
splitPath
:: String -> [String]
Splits a path string into list of directory names. |
lookupFileInPath
:: String -> [String] -> [String] -> IO (Maybe String)
Looks up the first file with a possible suffix in a list of directories. |
getFileInPath
:: String -> [String] -> [String] -> IO String
Gets the first file with a possible suffix in a list of directories. |
The character for separating hierarchies in file names.
On UNIX systems the value is
|
The character for separating names in path expressions.
On UNIX systems the value is
|
The character for separating suffixes in file names.
On UNIX systems the value is
|
Is the argument an absolute name? |
Extracts the directoy prefix of a given (Unix) file name. Returns "." if there is no prefix. |
Extracts the base name without directoy prefix of a given (Unix) file name. |
Splits a (Unix) file name into the directory prefix and the base name. The directory prefix is "." if there is no real prefix in the name. |
Strips a suffix (the last suffix starting with a dot) from a file name. |
Yields the suffix (the last suffix starting with a dot) from given file name. |
Splits a file name into prefix and suffix (the last suffix starting with a dot and the rest). |
Splits a path string into list of directory names. |
Looks up the first file with a possible suffix in a list of directories. Returns Nothing if such a file does not exist. |
Gets the first file with a possible suffix in a list of directories. An error message is delivered if there is no such file. |