summaryrefslogtreecommitdiff
path: root/Utility/Directory.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-02-03 16:47:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-02-03 16:47:24 -0400
commit146c36ca545a297f1e44e3cf2c91f3c0e17c909f (patch)
tree56d6fb274427bb793155182aed7e92e2e00895ba /Utility/Directory.hs
parent05f89123e08075cfbd136f37c60423c1ad38d1fe (diff)
IO exception rework
ghc 7.4 comaplains about use of System.IO.Error to catch exceptions. Ok, use Control.Exception, with variants specialized to only catch IO exceptions.
Diffstat (limited to 'Utility/Directory.hs')
-rw-r--r--Utility/Directory.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Utility/Directory.hs b/Utility/Directory.hs
index b5fedb9c7..e7b7c442b 100644
--- a/Utility/Directory.hs
+++ b/Utility/Directory.hs
@@ -16,11 +16,12 @@ import Control.Monad.IfElse
import Utility.SafeCommand
import Utility.TempFile
+import Utility.Exception
{- Moves one filename to another.
- First tries a rename, but falls back to moving across devices if needed. -}
moveFile :: FilePath -> FilePath -> IO ()
-moveFile src dest = try (rename src dest) >>= onrename
+moveFile src dest = tryIO (rename src dest) >>= onrename
where
onrename (Right _) = return ()
onrename (Left e)
@@ -40,11 +41,10 @@ moveFile src dest = try (rename src dest) >>= onrename
Param src, Param tmp]
unless ok $ do
-- delete any partial
- _ <- try $
- removeFile tmp
+ _ <- tryIO $ removeFile tmp
rethrow
isdir f = do
- r <- try (getFileStatus f)
+ r <- tryIO $ getFileStatus f
case r of
(Left _) -> return False
(Right s) -> return $ isDirectory s