Fix docs and rename RecursiveMode to RecursiveErrorMode

This commit is contained in:
Julian Ospald 2016-06-05 16:07:46 +02:00
parent 7a6f0e8728
commit d12ce30f57
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
2 changed files with 13 additions and 13 deletions

View File

@ -37,7 +37,7 @@ module HPath.IO
( (
-- * Types -- * Types
FileType(..) FileType(..)
, RecursiveMode(..) , RecursiveErrorMode(..)
, CopyMode(..) , CopyMode(..)
-- * File copying -- * File copying
, copyDirRecursive , copyDirRecursive
@ -219,7 +219,7 @@ data FileType = Directory
-- |The mode for any recursive operation. -- |The error mode for any recursive operation.
-- --
-- On `FailEarly` the whole operation fails immediately if any of the -- On `FailEarly` the whole operation fails immediately if any of the
-- recursive sub-operations fail, which is sort of the default -- recursive sub-operations fail, which is sort of the default
@ -228,8 +228,8 @@ data FileType = Directory
-- On `CollectFailures` skips errors in the recursion and keeps on recursing. -- On `CollectFailures` skips errors in the recursion and keeps on recursing.
-- However all errors are collected in the `RecursiveFailure` error type, -- However all errors are collected in the `RecursiveFailure` error type,
-- which is raised finally if there was any error. -- which is raised finally if there was any error.
data RecursiveMode = FailEarly data RecursiveErrorMode = FailEarly
| CollectFailures | CollectFailures
-- |The mode for copy and file moves. -- |The mode for copy and file moves.
@ -253,12 +253,12 @@ data CopyMode = Strict -- ^ fail if any target exists
-- For directory contents, this will ignore any file type that is not -- For directory contents, this will ignore any file type that is not
-- `RegularFile`, `SymbolicLink` or `Directory`. -- `RegularFile`, `SymbolicLink` or `Directory`.
-- --
-- For `Overwrite` mode this does not prune destination directory contents, -- For `Overwrite` copy mode this does not prune destination directory contents,
-- so the destination might contain more files than the source after -- so the destination might contain more files than the source after
-- the operation has completed. -- the operation has completed.
-- --
-- Note that there is no guaranteed ordering of the exceptions -- Note that there is no guaranteed ordering of the exceptions
-- contained within `RecursiveFailure` in `CollectFailures` RecursiveMode. -- contained within `RecursiveFailure` in `CollectFailures` RecursiveErrorMode.
-- --
-- Safety/reliability concerns: -- Safety/reliability concerns:
-- --
@ -278,13 +278,13 @@ data CopyMode = Strict -- ^ fail if any target exists
-- - `DestinationInSource` if destination is contained in source -- - `DestinationInSource` if destination is contained in source
-- (`HPathIOException`) -- (`HPathIOException`)
-- --
-- Throws in `FailEarly` RecursiveMode only: -- Throws in `FailEarly` RecursiveErrorMode only:
-- --
-- - `PermissionDenied` if output directory is not writable -- - `PermissionDenied` if output directory is not writable
-- - `InvalidArgument` if source directory is wrong type (symlink) -- - `InvalidArgument` if source directory is wrong type (symlink)
-- - `InappropriateType` if source directory is wrong type (regular file) -- - `InappropriateType` if source directory is wrong type (regular file)
-- --
-- Throws in `CollectFailures` RecursiveMode only: -- Throws in `CollectFailures` RecursiveErrorMode only:
-- --
-- - `RecursiveFailure` if any of the recursive operations that are not -- - `RecursiveFailure` if any of the recursive operations that are not
-- part of the top-directory sanity-checks fail (`HPathIOException`) -- part of the top-directory sanity-checks fail (`HPathIOException`)
@ -295,7 +295,7 @@ data CopyMode = Strict -- ^ fail if any target exists
copyDirRecursive :: Path Abs -- ^ source dir copyDirRecursive :: Path Abs -- ^ source dir
-> Path Abs -- ^ full destination -> Path Abs -- ^ full destination
-> CopyMode -> CopyMode
-> RecursiveMode -> RecursiveErrorMode
-> IO () -> IO ()
copyDirRecursive fromp destdirp cm rm copyDirRecursive fromp destdirp cm rm
= do = do
@ -348,7 +348,7 @@ copyDirRecursive fromp destdirp cm rm
-- |Recreate a symlink. -- |Recreate a symlink.
-- --
-- In `Overwrite` mode only files and empty directories are deleted. -- In `Overwrite` copy mode only files and empty directories are deleted.
-- --
-- Safety/reliability concerns: -- Safety/reliability concerns:
-- --
@ -399,7 +399,7 @@ recreateSymlink symsource newsym cm
-- examine file types. For a more high-level version, use `easyCopy` -- examine file types. For a more high-level version, use `easyCopy`
-- instead. -- instead.
-- --
-- In `Overwrite` mode only overwrites actual files, not directories. -- In `Overwrite` copy mode only overwrites actual files, not directories.
-- --
-- Safety/reliability concerns: -- Safety/reliability concerns:
-- --
@ -514,7 +514,7 @@ _copyFile sflags dflags from to
easyCopy :: Path Abs easyCopy :: Path Abs
-> Path Abs -> Path Abs
-> CopyMode -> CopyMode
-> RecursiveMode -> RecursiveErrorMode
-> IO () -> IO ()
easyCopy from to cm rm = do easyCopy from to cm rm = do
ftype <- getFileType from ftype <- getFileType from

View File

@ -169,7 +169,7 @@ copyFile' inputFileP outputFileP cm =
copyDirRecursive' :: ByteString -> ByteString copyDirRecursive' :: ByteString -> ByteString
-> CopyMode -> RecursiveMode -> IO () -> CopyMode -> RecursiveErrorMode -> IO ()
{-# NOINLINE copyDirRecursive' #-} {-# NOINLINE copyDirRecursive' #-}
copyDirRecursive' inputDirP outputDirP cm rm = copyDirRecursive' inputDirP outputDirP cm rm =
withTmpDir' inputDirP outputDirP (\p1 p2 -> copyDirRecursive p1 p2 cm rm) withTmpDir' inputDirP outputDirP (\p1 p2 -> copyDirRecursive p1 p2 cm rm)