Ticket #1838 (closed merge: fixed)
do not use getEnv "HOME", use System.Directory.getHomeDirectory
|Reported by:||guest||Owned by:||igloo|
|Type of failure:||Difficulty:||Unknown|
|Test Case:||Blocked By:|
[i've set component to ghci, but this isn't limited to ghci]
i was wondering where ghci was looking for ~/.ghci on windows, because that doesn't seem to work for me, unless i run ghcii.sh under cygwin, inheriting cygwin's HOME environment variable.
my win/xp doesn't have %HOME%, the closest i can find in the docs are %HOMEDRIVE% and %HOMEPATH%. there is some special casing in System.Directory.getHomeDirectory, which seems to follow a different route via a C helper, but ends up with the same result (here a session with a plain windows ghci 6.6.1, but the code hasn't changed in head):
Prelude> System.Environment.getEnv "HOME" *** Exception: HOME: getEnv: does not exist (no environment variable) Prelude> System.Environment.getEnv "HOMEPATH" "\\Documents and Settings\\cr3" Prelude> System.Environment.getEnv "HOMEDRIVE" "C:" Prelude> System.Directory.getHomeDirectory "C:\\Documents and Settings\\cr3"
the main culprit seems to be compiler/ghci/InteractiveUI.hs, with 2 cases. there also seem to be several instances of Compat/Directory.hs, in compat/, in libraries/bootstrapping.Cabal/Distribution/, and in libraries/Cabal/Distribution/.
could the ghci uses (and possibly the Compat uses as well?) please be replaced with uses of System.Directory.getHomeDirectory?