@@ -8,7 +8,7 @@ module System.File.OsPath.Internal where
88
99import qualified System.File.Platform as P
1010
11- import Prelude ((.) , ($) , String , IO , ioError , pure , either , const , flip , Maybe (.. ), fmap , (<$>) , id , Bool (.. ), FilePath , (++) , return , show , (>>=) , (==) , otherwise , errorWithoutStackTrace )
11+ import Prelude ((.) , ($) , String , IO , ioError , pure , either , const , flip , Maybe (.. ), fmap , (<$>) , id , Bool (.. ), FilePath , (++) , return , show , (>>=) , (==) , otherwise , errorWithoutStackTrace , userError )
1212import GHC.IO (catchException )
1313import GHC.IO.Exception (IOException (.. ))
1414import GHC.IO.Handle (hClose_help )
@@ -17,7 +17,7 @@ import GHC.IO.Handle.Types (Handle__, Handle(..))
1717import Control.Concurrent.MVar
1818import Control.Monad (void , when )
1919import Control.DeepSeq (force )
20- import Control.Exception (SomeException , try , evaluate , mask , onException )
20+ import Control.Exception (SomeException , try , evaluate , mask , onException , throwIO )
2121import System.IO (IOMode (.. ), hSetBinaryMode , hClose )
2222import System.IO.Unsafe (unsafePerformIO )
2323import System.OsString (osstr )
@@ -28,7 +28,6 @@ import qualified Data.ByteString as BS
2828import qualified Data.ByteString.Lazy as BSL
2929import qualified System.OsString as OSS
3030import System.Posix.Types (CMode )
31- import GHC.Base (failIO )
3231
3332-- | Like 'openFile', but open the file in binary mode.
3433-- On Windows, reading a file in text mode (which is the default)
@@ -234,7 +233,7 @@ openTempFile' :: String -> OsPath -> OsString -> Bool -> CMode
234233 -> IO (OsPath , Handle )
235234openTempFile' loc (OsString tmp_dir) template@ (OsString tmpl) binary mode
236235 | OSS. any (== OSP. pathSeparator) template
237- = failIO $ " openTempFile': Template string must not contain path separator characters: " ++ P. lenientDecode tmpl
236+ = throwIO $ userError $ " openTempFile': Template string must not contain path separator characters: " ++ P. lenientDecode tmpl
238237 | otherwise = do
239238 (fp, hdl) <- P. findTempName (prefix, suffix) loc tmp_dir mode
240239 when binary $ hSetBinaryMode hdl True
0 commit comments