Update GHC environment location (fixes #6565)#6822
Update GHC environment location (fixes #6565)#6822phadej merged 3 commits intohaskell:masterfrom vituscze:win-environments
Conversation
Previously, cabal-install assumed that the default GHC environments are located in $HOME/.ghc/ on all systems. However, on Windows, GHC looks for environments in %APPDATA%/ghc/
|
FWIW, the GHC documentation is then incorrect, https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/packages.html#package-environments explicitly mentions $(HOME) cf. the package databases section which says https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/packages.html#package-databases
cc @bgamari I suspect that GHC indeed relies on That said, this PR is good. We should move the logic of finding GHC environment file directory somewhere in |
|
Did you mean something like this? https://github.com/vituscze/cabal/commit/a57bb3396db1042666d8225ebd3bf54ce2e1dc9c |
|
@vituscze I'd rather go for simpler if GHC sometimes decide to change its mind about where to place files, we'd need to change it only in one place. |
cabal-install currently assumes that the GHC environment files are always located in
$HOME/.ghc/. However, GHC itself doesn't query the home directory directly. Instead, it usesgetAppUserDataDirectory "ghc"(GHC code, getAppUserDataDirectory) which happens to coincide with$HOME/.ghc/on UNIX systems. On Windows, however, GHC ends up looking in%APPDATA%/ghc/.As a result,
cabal install --libdoesn't change the correct environment files on Windows.This PR changes the environment file locations to match GHC. On UNIX, there is no change since
getAppUserDataDirectory "ghc"is defined as(</> ".ghc") <$> getHomeDirectory. On windows, I have confirmed that cabal-install changes the correct GHC environment file with this PR.Please include the following checklist in your PR:
changelog.ddirectory).