Commit d297cfc0 authored by Simon Marlow's avatar Simon Marlow
Browse files

:cd with no argument goes to the user's home directory

Seems better than getting a confusing 'cannot find directory' exception.
parent ab89dc19
......@@ -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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment