do not use getEnv "HOME", use System.Directory.getHomeDirectory
[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
?
Trac metadata
Trac field | Value |
---|---|
Version | 6.6.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | claus.reinke@talk21.com |
Operating system | |
Architecture | Unknown |