projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ab89dc1
)
:cd with no argument goes to the user's home directory
author
Simon Marlow
<simonmar@microsoft.com>
Tue, 4 Dec 2007 11:39:45 +0000
(11:39 +0000)
committer
Simon Marlow
<simonmar@microsoft.com>
Tue, 4 Dec 2007 11:39:45 +0000
(11:39 +0000)
Seems better than getting a confusing 'cannot find directory' exception.
compiler/ghci/InteractiveUI.hs
patch
|
blob
|
history
diff --git
a/compiler/ghci/InteractiveUI.hs
b/compiler/ghci/InteractiveUI.hs
index
3ae37f5
..
8cc1513
100644
(file)
--- a/
compiler/ghci/InteractiveUI.hs
+++ b/
compiler/ghci/InteractiveUI.hs
@@
-846,6
+846,12
@@
addModule files = do
afterLoad ok session False prev_context
changeDirectory :: String -> GHCi ()
+changeDirectory "" = do
+ -- :cd on its own changes to the user's home directory
+ either_dir <- io (IO.try getHomeDirectory)
+ case either_dir of
+ Left _e -> return ()
+ Right dir -> changeDirectory dir
changeDirectory dir = do
session <- getSession
graph <- io (GHC.getModuleGraph session)