From: rrt Date: Tue, 26 Jun 2001 15:51:55 +0000 (+0000) Subject: [project @ 2001-06-26 15:51:55 by rrt] X-Git-Tag: Approximately_9120_patches~1715 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=3b8aa6ae473ed794ba1dd63af1ffbc78636ef21e;p=ghc-hetmet.git [project @ 2001-06-26 15:51:55 by rrt] Make stage two getExecDir for Windows work again. Where did it go before? --- diff --git a/ghc/compiler/main/SysTools.lhs b/ghc/compiler/main/SysTools.lhs index 4f1eb60..2c29334 100644 --- a/ghc/compiler/main/SysTools.lhs +++ b/ghc/compiler/main/SysTools.lhs @@ -56,11 +56,13 @@ import IOExts ( IORef, readIORef, writeIORef ) import Monad ( when, unless ) import System ( system, ExitCode(..), exitWith ) import CString +import Addr +import Int #if __GLASGOW_HASKELL__ < 500 -import Addr import Storable -import Int +#else +import MarshalArray #endif #include "../includes/config.h" @@ -650,8 +652,9 @@ foreign import "_getpid" getProcessID :: IO Int -- relies on Int == Int32 on Win #if __GLASGOW_HASKELL__ >= 500 foreign import stdcall "GetCurrentDirectoryA" getCurrentDirectory :: Int32 -> CString -> IO Int32 +foreign import stdcall "GetCurrentDirectoryA" getCurrentDirectoryLen :: Int32 -> Addr -> IO Int32 getExecDir :: IO (Maybe String) -getExecDir = do len <- getCurrentDirectory 0 nullAddr +getExecDir = do len <- getCurrentDirectoryLen 0 nullAddr buf <- mallocArray (fromIntegral len) ret <- getCurrentDirectory len buf if ret == 0 then return Nothing