diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2017-06-13 15:26:47 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2017-06-13 15:26:47 +0300 |
commit | cd890acc6fbb2b228f0903f0cea313fde02c026f (patch) | |
tree | 3c77877df3ccff9e88eb8306009e6cc4bbf6a309 /src/WindowsEnv/Environment.hs | |
parent | bump version (diff) | |
download | windows-env-cd890acc6fbb2b228f0903f0cea313fde02c026f.tar.gz windows-env-cd890acc6fbb2b228f0903f0cea313fde02c026f.zip |
refactoring
Diffstat (limited to '')
-rw-r--r-- | src/WindowsEnv/Environment.hs | 4 |
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" $ |