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.
This commit is contained in:
parent
05f89123e0
commit
146c36ca54
14 changed files with 56 additions and 44 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue