aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Main.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 5a4e27cc..4c0728db 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -69,6 +69,7 @@ handleTopExceptions :: IO a -> IO a
handleTopExceptions =
handleNormalExceptions . handleHaddockExceptions . handleGhcExceptions
+
-- | Either returns normally or throws an ExitCode exception;
-- all other exceptions are turned into exit exceptions.
handleNormalExceptions :: IO a -> IO a
@@ -336,6 +337,7 @@ withGhc libDir flags ghcActs = do
-- Misc
-------------------------------------------------------------------------------
+
getHaddockLibDir :: [Flag] -> IO String
getHaddockLibDir flags =
case [str | Flag_Lib str <- flags] of
@@ -347,6 +349,7 @@ getHaddockLibDir flags =
#endif
fs -> return (last fs)
+
getGhcLibDir :: [Flag] -> IO String
getGhcLibDir flags =
case [ dir | Flag_GhcLibDir dir <- flags ] of
@@ -426,6 +429,7 @@ getInTreeLibDir =
Just d -> return (d </> "..")
#endif
+
getExecDir :: IO (Maybe String)
#if defined(mingw32_HOST_OS)
getExecDir = allocaArray len $ \buf -> do
@@ -436,6 +440,7 @@ getExecDir = allocaArray len $ \buf -> do
return (Just (dropFileName s))
where len = 2048 -- Plenty, PATH_MAX is 512 under Win32.
+
foreign import stdcall unsafe "GetModuleFileNameA"
getModuleFileName :: Ptr () -> CString -> Int -> IO Int32
#else