diff options
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/Directory.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Utility/Directory.hs b/Utility/Directory.hs index 5bfd49a9c..52f2396d7 100644 --- a/Utility/Directory.hs +++ b/Utility/Directory.hs @@ -88,6 +88,13 @@ moveFile src dest = tryIO (rename src dest) >>= onrename (Left _) -> return False (Right s) -> return $ isDirectory s +{- Removes a file, which may or may not exist. + - + - Note that an exception is thrown if the file exists but + - cannot be removed. -} +nukeFile :: FilePath -> IO () +nukeFile file = whenM (doesFileExist file) $ removeFile file + {- Runs an action in another directory. -} bracketCd :: FilePath -> IO a -> IO a bracketCd dir a = go =<< getCurrentDirectory |