Copyright | (c) Joel Williamson 2015 |
---|---|
License | BSD 3-clause |
Maintainer | joel.s.williamson@gmail.com |
Stability | Testing |
Safe Haskell | None |
Language | Haskell2010 |
A uniform interface over file archives and directories
- class FileCollection d where
- createDirectory :: d -> FilePath -> IO d
- createDirectoryIfMissing :: d -> FilePath -> IO d
- removeDirectory :: d -> FilePath -> IO d
- removeDirectoryRecursive :: d -> FilePath -> IO d
- renameDirectory :: d -> FilePath -> FilePath -> IO d
- getDirectoryContents :: d -> FilePath -> IO [FilePath]
- removeFile :: d -> FilePath -> IO d
- renameFile :: d -> FilePath -> FilePath -> IO d
- copyFile :: d -> FilePath -> FilePath -> IO d
- findFile :: d -> [FilePath] -> String -> IO (Maybe FilePath)
- findFiles :: d -> [FilePath] -> String -> IO [FilePath]
- doesFileExist :: d -> FilePath -> IO Bool
- doesDirectoryExist :: d -> FilePath -> IO Bool
Documentation
class FileCollection d where Source
class FileCollection d where
An object that is a heirarchical arrangement
| of files. This could be a tree in the file system, or a file archive.
createDirectory :: d -> FilePath -> IO d Source
creates a new directory root/path which
| is initially empty. The path to the new directory is returned.createDirectory
root path
createDirectoryIfMissing :: d -> FilePath -> IO d Source
creates a new directory root/path
| if it doesn't exist. It also creates any missing ancestors of createDirectoryIfMissing
root pathpath
removeDirectory :: d -> FilePath -> IO d Source
removes an existing directory dir.removeDirectory
root dir
removeDirectoryRecursive :: d -> FilePath -> IO d Source
removes a directory dir and all
| its contents and subdirectories.removeDirectoryRecursive
root dir
renameDirectory :: d -> FilePath -> FilePath -> IO d Source
changes the name of an existing
| directory from source to target. If the target directory already
| exists, it can be removed or merged with the source directory.renameDirectory
root source target
getDirectoryContents :: d -> FilePath -> IO [FilePath] Source
returns a list of all entries
| immediately contained in dir.getDirectoryContents
root dir
removeFile :: d -> FilePath -> IO d Source
removes the directory entry for an existing file,
| where file is not a directory.removeFile
root file
renameFile :: d -> FilePath -> FilePath -> IO d Source
changes the name of an existing file from old
| to new. If the new object already exists, it is replaced by old.renameFile
root old new
copyFile :: d -> FilePath -> FilePath -> IO d Source
creates a duplicate of old with the name new.copyFile
root old new
findFile :: d -> [FilePath] -> String -> IO (Maybe FilePath) Source
returns the path of file if it can be found
| in any of dirs.findFile
root dirs file
findFiles :: d -> [FilePath] -> String -> IO [FilePath] Source
doesFileExist :: d -> FilePath -> IO Bool Source
returns True if path exists and is not a
| directory.doesFileExist
root path
doesDirectoryExist :: d -> FilePath -> IO Bool Source
returns True if /path exists and is a
| directory.doesDirectoryExist
root path