Skip to content
Snippets Groups Projects
Commit 728ad1a1 authored by Tamar Christina's avatar Tamar Christina Committed by Herbert Valerio Riedel
Browse files

Conditionally define values (#5182)

(cherry picked from commit 2d222368)
parent 2b73e706
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,9 @@ import Distribution.Compat.Stack
#ifdef mingw32_HOST_OS
import Foreign.C
#if __GLASGOW_HASKELL__ < 708
import Foreign.Ptr (nullPtr)
#endif
import GHC.Windows
#else
import Foreign.C.Types
......@@ -123,6 +126,12 @@ unsetEnv key = withCWString key $ \k -> do
err <- c_GetLastError
unless (err == eRROR_ENVVAR_NOT_FOUND) $ do
throwGetLastError "unsetEnv"
eRROR_ENVVAR_NOT_FOUND :: DWORD
eRROR_ENVVAR_NOT_FOUND = 203
foreign import WINDOWS_CCONV unsafe "windows.h GetLastError"
c_GetLastError:: IO DWORD
#else
unsetEnv key = withFilePath key (throwErrnoIf_ (/= 0) "unsetEnv" . c_unsetenv)
#if __GLASGOW_HASKELL__ > 706
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment