From ee001d1f2d6001bd06ac1cad432947a547daf0c8 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sun, 4 Jan 2009 17:31:59 +0000 Subject: [PATCH] Avoid using IOError internals --- System/Directory.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index afa38eb..20980a7 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -491,8 +491,9 @@ renameDirectory opath npath = withFileStatus "renameDirectory" opath $ \st -> do is_dir <- isDirectory st if (not is_dir) - then ioException (IOError Nothing InappropriateType "renameDirectory" - ("not a directory") (Just opath)) + then ioException (ioeSetErrorString + (mkIOError InappropriateType "renameDirectory" Nothing (Just opath)) + "not a directory") else do #ifdef mingw32_HOST_OS System.Win32.moveFileEx opath npath System.Win32.mOVEFILE_REPLACE_EXISTING @@ -550,8 +551,9 @@ renameFile opath npath = withFileOrSymlinkStatus "renameFile" opath $ \st -> do is_dir <- isDirectory st if is_dir - then ioException (IOError Nothing InappropriateType "renameFile" - "is a directory" (Just opath)) + then ioException (ioeSetErrorString + (mkIOError InappropriateType "renameFile" Nothing (Just opath)) + "is a directory") else do #ifdef mingw32_HOST_OS System.Win32.moveFileEx opath npath System.Win32.mOVEFILE_REPLACE_EXISTING @@ -1096,7 +1098,7 @@ foreign import stdcall unsafe "GetTempPathA" c_GetTempPath :: CInt -> CString -> raiseUnsupported :: String -> IO () raiseUnsupported loc = - ioException (IOError Nothing UnsupportedOperation loc "unsupported operation" Nothing) + ioException (ioeSetErrorString (mkIOError UnsupportedOperation loc Nothing Nothing) "unsupported operation") #endif -- 1.7.10.4