| |||||||||||||||||||
| |||||||||||||||||||
| |||||||||||||||||||
Description | |||||||||||||||||||
This module provides various helpful utilities for dealing with path and file names, directories, and related support. Written by John Goerzen, jgoerzen@complete.org | |||||||||||||||||||
Synopsis | |||||||||||||||||||
| |||||||||||||||||||
Name processing | |||||||||||||||||||
splitExt :: String -> (String, String) | |||||||||||||||||||
Splits a pathname into a tuple representing the root of the name and the extension. The extension is considered to be all characters from the last dot after the last slash to the end. Either returned string may be empty. | |||||||||||||||||||
absNormPath | |||||||||||||||||||
| |||||||||||||||||||
secureAbsNormPath | |||||||||||||||||||
| |||||||||||||||||||
Directory Processing | |||||||||||||||||||
recurseDir :: HVFS a => a -> FilePath -> IO [FilePath] | |||||||||||||||||||
Obtain a recursive listing of all files/directories beneath the specified directory. The traversal is depth-first and the original item is always present in the returned list. If the passed value is not a directory, the return value be only that value. The "." and ".." entries are removed from the data returned. | |||||||||||||||||||
recurseDirStat :: HVFS a => a -> FilePath -> IO [(FilePath, HVFSStatEncap)] | |||||||||||||||||||
Like recurseDir, but return the stat() (System.Posix.Files.FileStatus) information with them. This is an optimization if you will be statting files yourself later. The items are returned lazily. WARNING: do not change your current working directory until you have consumed all the items. Doing so could cause strange effects. Alternatively, you may wish to pass an absolute path to this function. | |||||||||||||||||||
recursiveRemove :: HVFS a => a -> FilePath -> IO () | |||||||||||||||||||
Removes a file or a directory. If a directory, also removes all its child files/directories. | |||||||||||||||||||
bracketCWD :: FilePath -> IO a -> IO a | |||||||||||||||||||
Changes the current working directory to the given path, executes the given I/O action, then changes back to the original directory, even if the I/O action raised an exception. | |||||||||||||||||||
Temporary Directories | |||||||||||||||||||
mktmpdir :: String -> IO String | |||||||||||||||||||
Creates a temporary directory for your use. The passed string should be a template suitable for mkstemp; that is, end with "XXXXXX". Your string should probably start with the value returned from System.Directory.getTemporaryDirectory. The name of the directory created will be returned. | |||||||||||||||||||
brackettmpdir :: String -> (String -> IO a) -> IO a | |||||||||||||||||||
Creates a temporary directory for your use via mktmpdir, runs the specified action (passing in the directory name), then removes the directory and all its contents when the action completes (or raises an exception. | |||||||||||||||||||
brackettmpdirCWD :: String -> IO a -> IO a | |||||||||||||||||||
Runs the given I/O action with the CWD set to the given tmp dir, removing the tmp dir and changing CWD back afterwards, even if there was an exception. | |||||||||||||||||||
Produced by Haddock version 0.8 |