From 492fe0e4402f0a94443208b68e909b3c68d9f23c Mon Sep 17 00:00:00 2001 From: shelarcy Date: Mon, 30 May 2005 15:13:33 +0000 Subject: [PATCH] now syslibdir definition is correct for Window_NT, 2000 or later. I don't know Windows 9X has OS system variable. --- src/plugins/System/Plugins/Env.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/System/Plugins/Env.hs b/src/plugins/System/Plugins/Env.hs index ae73ad2..6f99f9c 100644 --- a/src/plugins/System/Plugins/Env.hs +++ b/src/plugins/System/Plugins/Env.hs @@ -64,6 +64,7 @@ import Data.List ( isPrefixOf, nub ) import System.IO.Unsafe ( unsafePerformIO ) import System.Directory ( doesFileExist ) #if defined(CYGWIN) || defined(__MINGW32__) +import Prelude hiding ( catch, ioError ) import System.Environment ( getEnv ) import System.IO.Error ( catch, ioError, isDoesNotExistError ) #endif @@ -382,9 +383,15 @@ lookupPkg' p = withPkgEnvs env $ \fms -> go fms p #endif libs <- mapM (findHSlib libdirs) (hslibs ++ cbits) #if defined(CYGWIN) || defined(__MINGW32__) + windowsos <- catch (getEnv "OS") + (\e -> if isDoesNotExistError e then return "Windows_98" else ioError e) + windowsdir <- + if windowsos == "Windows_9X" -- I don't know Windows 9X has OS system variable + then return "C:/windows" + else return "C:/winnt" sysroot <- catch (getEnv "SYSTEMROOT") - (\e -> if isDoesNotExistError e then return "C:/windows" else ioError e) -- guess at a reasonable default - let syslibdir = sysroot ++ "/SYSTEM" + (\e -> if isDoesNotExistError e then return windowsdir else ioError e) -- guess at a reasonable default + let syslibdir = sysroot ++ (if windowsos == "Windows_9X" then "/SYSTEM" else "/SYSTEM32") libs' <- mapM (findDLL $ syslibdir : libdirs) dlls #else libs' <- mapM (findDLL libdirs) dlls