X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=5c014beffa4035d5297226c3cfc283498478c68c;hb=5b1a5b1e82c9a75f9c657839d8d321822622a1e8;hp=d2d19be82d861379f887a9c02900dbaba92ded08;hpb=7f4807640530a0e4d9d7efdeb6becee514274f02;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index d2d19be..5c014be 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,6 +1,6 @@ {-# OPTIONS -#include "Linker.h" #-} ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.153 2003/05/19 15:39:17 simonpj Exp $ +-- $Id: InteractiveUI.hs,v 1.157 2003/07/21 14:33:19 simonmar Exp $ -- -- GHC Interactive User Interface -- @@ -22,7 +22,7 @@ import HsSyn ( TyClDecl(..), ConDecl(..), Sig(..) ) import MkIface ( ifaceTyThing ) import DriverFlags import DriverState -import DriverUtil ( remove_spaces, handle ) +import DriverUtil ( remove_spaces ) import Linker ( showLinkerState, linkPackages ) import Util import IdInfo ( GlobalIdDetails(..) ) @@ -45,6 +45,7 @@ import Panic hiding ( showException ) import Config #ifndef mingw32_HOST_OS +import DriverUtil( handle ) import System.Posix #if __GLASGOW_HASKELL__ > 504 hiding (getEnv) @@ -157,8 +158,7 @@ helpText = "\ interactiveUI :: [FilePath] -> IO () interactiveUI srcs = do dflags <- getDynFlags - saveDynFlags -- Save the dynamic flags, so that - -- the later restore will find them + cmstate <- cmInit Interactive; hFlush stdout @@ -542,6 +542,14 @@ addModule files = do changeDirectory :: String -> GHCi () changeDirectory dir = do + state <- getGHCiState + when (targets state /= []) $ + io $ putStr "Warning: changing directory causes all loaded modules to be unloaded, \n\ + \because the search path has changed.\n" + dflags <- io getDynFlags + cmstate1 <- io (cmUnload (cmstate state) dflags) + setGHCiState state{ cmstate = cmstate1, targets = [] } + setContextAfterLoad [] dir <- expandPath dir io (setCurrentDirectory dir)