file-collection-0.1.1.4: Provide a uniform interface over file archives and directories

Copyright(c) Joel Williamson 2015
LicenseBSD 3-clause
Maintainerjoel.s.williamson@gmail.com
StabilityTesting
Safe HaskellNone
LanguageHaskell2010

Codec.Archive.FileCollection

Description

A uniform interface over file archives and directories

Synopsis

Documentation

class File (AssocFile d) => 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.

Associated Types

type AssocFile d :: * Source

An element in the collection, capable of being read from.

Methods

createDirectory :: d -> FilePath -> IO d Source

createDirectory root path creates a new directory root/path which | is initially empty. The path to the new directory is returned.

createDirectoryIfMissing :: d -> FilePath -> IO d Source

createDirectoryIfMissing root path creates a new directory root/path | if it doesn't exist. It also creates any missing ancestors of path

removeDirectory :: d -> FilePath -> IO d Source

removeDirectory root dir removes an existing directory dir.

removeDirectoryRecursive :: d -> FilePath -> IO d Source

removeDirectoryRecursive root dir removes a directory dir and all | its contents and subdirectories.

renameDirectory :: d -> FilePath -> FilePath -> IO d Source

renameDirectory root source target 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.

getDirectoryContents :: d -> FilePath -> IO [FilePath] Source

getDirectoryContents root dir returns a list of all entries | immediately contained in dir.

getFile :: d -> FilePath -> AssocFile d Source

getFile filePath returns a `AssocFile d` with the given path. | /Warning: Error checking is not guaranteed. This should only be used with | the output from getDirectoryContents

removeFile :: d -> FilePath -> IO d Source

removeFile root file removes the directory entry for an existing file, | where file is not a directory.

renameFile :: d -> FilePath -> FilePath -> IO d Source

renameFile root old new changes the name of an existing file from old | to new. If the new object already exists, it is replaced by old.

copyFile :: d -> FilePath -> FilePath -> IO d Source

copyFile root old new creates a duplicate of old with the name new.

addFile :: d -> AssocFile d -> IO d Source

addFile root file adds the file to the collection if it isn't already | present.

findFile :: d -> [FilePath] -> String -> IO (Maybe (AssocFile d)) Source

findFile root dirs file returns the path of file if it can be found | in any of dirs.

findFiles :: d -> [FilePath] -> String -> IO [AssocFile d] Source

doesFileExist :: d -> FilePath -> IO Bool Source

doesFileExist root path returns True if path exists and is not a | directory.

doesDirectoryExist :: d -> FilePath -> IO Bool Source

doesDirectoryExist root path returns True if /path exists and is a | directory.