summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
38ca3fe)
Make stage two getExecDir for Windows work again. Where did it go before?
import Monad ( when, unless )
import System ( system, ExitCode(..), exitWith )
import CString
import Monad ( when, unless )
import System ( system, ExitCode(..), exitWith )
import CString
#if __GLASGOW_HASKELL__ < 500
#if __GLASGOW_HASKELL__ < 500
+#else
+import MarshalArray
#endif
#include "../includes/config.h"
#endif
#include "../includes/config.h"
#if __GLASGOW_HASKELL__ >= 500
foreign import stdcall "GetCurrentDirectoryA" getCurrentDirectory :: Int32 -> CString -> IO Int32
#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 :: 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
buf <- mallocArray (fromIntegral len)
ret <- getCurrentDirectory len buf
if ret == 0 then return Nothing