Commit afd10065 authored by sof's avatar sof
Browse files

[project @ 2001-07-17 17:27:20 by sof]

Drop the dependency on the Win32 library, as it is only used in an
extremely limited way (a single 'foreign import' is all that's reqd)
[Sorry Reuben, I don't buy your 'extra deps are good' argument :-) ]
parent 98cbc33b
# -----------------------------------------------------------------------------
# $Id: Makefile,v 1.175 2001/07/16 15:46:09 sof Exp $
# $Id: Makefile,v 1.176 2001/07/17 17:27:20 sof Exp $
TOP = ..
include $(TOP)/mk/boilerplate.mk
......@@ -224,7 +224,7 @@ SRC_HC_OPTS += \
ifneq "$(mingw32_TARGET_OS)" "1"
SRC_HC_OPTS += -package concurrent -package posix -package text -package util
else
SRC_HC_OPTS += -package concurrent -package win32 -package text -package util
SRC_HC_OPTS += -package concurrent -package text -package util
endif
SRC_CC_OPTS += -Iparser -I. -I$(TOP)/includes -O
......
......@@ -54,16 +54,19 @@ import IO
import Directory ( doesFileExist, removeFile )
import IOExts ( IORef, readIORef, writeIORef )
import Monad ( when, unless )
import System ( system, ExitCode(..), exitWith, getEnv )
import System ( system, ExitCode(..), exitWith )
import CString
import Int
import Addr
#include "../includes/config.h"
#if !defined(mingw32_TARGET_OS)
import qualified Posix
#else
import Win32DLL
import List ( isPrefixOf, isSuffixOf )
import List ( isPrefixOf )
#endif
import MarshalArray
#include "HsVersions.h"
......@@ -685,9 +688,15 @@ slash s1 s2 = s1 ++ ('/' : s2)
#if defined(mingw32_TARGET_OS)
getExecDir :: IO (Maybe String)
getExecDir = do h <- getModuleHandle Nothing
n <- getModuleFileName h
return (Just (reverse (drop (length "/bin/ghc.exe") (reverse (unDosifyPath n)))))
getExecDir = do let len = 2048
buf <- mallocArray (fromIntegral len)
ret <- getModuleFileName nullAddr buf len
if ret == 0 then return Nothing
else do s <- peekCString buf
destructArray (fromIntegral len) buf
return (Just (reverse (tail (dropWhile (not . isSlash) (reverse (unDosifyPath s))))))
foreign import stdcall "GetModuleFileNameA" getModuleFileName :: Addr -> CString -> Int32 -> IO Int32
#else
getExecDir :: IO (Maybe String) = do return Nothing
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment