From 8b0e59faa70e8247b94299145031621c9a36224b Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Tue, 3 May 2016 11:55:34 +0200 Subject: [PATCH] LIB: improve documentation --- src/HSFM/FileSystem/FileOperations.hs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/HSFM/FileSystem/FileOperations.hs b/src/HSFM/FileSystem/FileOperations.hs index a2a9dab..b85a6ac 100644 --- a/src/HSFM/FileSystem/FileOperations.hs +++ b/src/HSFM/FileSystem/FileOperations.hs @@ -406,17 +406,35 @@ deleteFile p = P.withAbsPath p removeLink -- |Deletes the given directory, which must be empty, never symlinks. +-- +-- Throws: +-- +-- - `InappropriateType` for wrong file type (symlink to directory) +-- - `InappropriateType` for wrong file type (regular file) +-- - `NoSuchThing` if directory does not exist +-- - `UnsatisfiedConstraints` if directory is not empty +-- - `PermissionDenied` if we can't open or write to parent directory +-- +-- Notes: calls `rmdir` deleteDir :: Path Abs -> IO () deleteDir p = P.withAbsPath p removeDirectory -- |Deletes the given directory recursively. Does not follow symbolic --- links. +-- links. Tries `deleteDir` first before attemtping a recursive +-- deletion. -- -- Safety/reliability concerns: -- -- * not atomic -- * examines filetypes explicitly +-- +-- Throws: +-- +-- - `InappropriateType` for wrong file type (symlink to directory) +-- - `InappropriateType` for wrong file type (regular file) +-- - `NoSuchThing` if directory does not exist +-- - `PermissionDenied` if we can't open or write to parent directory deleteDirRecursive :: Path Abs -> IO () deleteDirRecursive p = catchErrno [eNOTEMPTY, eEXIST]