#1838: do not use getEnv "HOME", use System.Directory.getHomeDirectory
------------------------+---------------------------------------------------
    Reporter:  guest    |       Owner:         
        Type:  bug      |      Status:  new    
    Priority:  normal   |   Component:  GHCi   
     Version:  6.6.1    |    Severity:  normal 
    Keywords:           |    Testcase:         
Architecture:  Unknown  |          Os:  Windows
------------------------+---------------------------------------------------
 [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`?

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1838>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to