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