aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/WindowsEnv/Environment.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WindowsEnv/Environment.hs')
-rw-r--r--src/WindowsEnv/Environment.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/WindowsEnv/Environment.hs b/src/WindowsEnv/Environment.hs
index aa05017..6784d43 100644
--- a/src/WindowsEnv/Environment.hs
+++ b/src/WindowsEnv/Environment.hs
@@ -34,7 +34,7 @@ import Data.List (intercalate)
import Data.List.Split (splitOn)
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Storable (sizeOf)
-import System.IO.Error (catchIOError, isDoesNotExistError)
+import System.IO.Error (isDoesNotExistError, tryIOError)
import qualified System.Win32.Types as WinAPI
import qualified WindowsEnv.Registry as Registry
@@ -108,7 +108,7 @@ foreign import WINDOWS_ENV_CCALL unsafe "Windows.h ExpandEnvironmentStringsW"
c_ExpandEnvironmentStrings :: WinAPI.LPCTSTR -> WinAPI.LPTSTR -> WinAPI.DWORD -> IO WinAPI.ErrCode
expand :: String -> ExceptT IOError IO String
-expand value = ExceptT $ catchIOError (Right <$> doExpand) (return . Left)
+expand value = ExceptT $ tryIOError doExpand
where
doExpandIn valuePtr bufferPtr bufferLength = do
newBufferLength <- WinAPI.failIfZero "ExpandEnvironmentStringsW" $