[commit: ghc] master: Don't hardcode the name "ghc" in versionedAppDir (6392df0)
git at git.haskell.org
git at git.haskell.org
Fri Jan 16 16:14:53 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/6392df07e89304a4daeb1af379c051b03a39cda7/ghc
>---------------------------------------------------------------
commit 6392df07e89304a4daeb1af379c051b03a39cda7
Author: Edsko de Vries <edsko at well-typed.com>
Date: Wed Jan 14 17:58:13 2015 -0600
Don't hardcode the name "ghc" in versionedAppDir
Reviewers: austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D618
>---------------------------------------------------------------
6392df07e89304a4daeb1af379c051b03a39cda7
compiler/main/CmdLineParser.hs | 2 +-
compiler/main/DynFlags.hs | 8 ++++----
compiler/main/Packages.hs | 5 ++---
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/compiler/main/CmdLineParser.hs b/compiler/main/CmdLineParser.hs
index e80f688..422fa13 100644
--- a/compiler/main/CmdLineParser.hs
+++ b/compiler/main/CmdLineParser.hs
@@ -18,7 +18,7 @@ module CmdLineParser
Flag(..), defFlag, defGhcFlag, defGhciFlag, defHiddenFlag,
errorsToGhcException,
- EwM(..), runEwM, addErr, addWarn, getArg, getCurLoc, liftEwM, deprecate
+ EwM, runEwM, addErr, addWarn, getArg, getCurLoc, liftEwM, deprecate
) where
#include "HsVersions.h"
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 5ef6ce4..eccb14e 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -1022,9 +1022,9 @@ opt_lc dflags = sOpt_lc (settings dflags)
-- | The directory for this version of ghc in the user's app directory
-- (typically something like @~/.ghc/x86_64-linux-7.6.3@)
--
-versionedAppDir :: IO FilePath
-versionedAppDir = do
- appdir <- getAppUserDataDirectory "ghc"
+versionedAppDir :: DynFlags -> IO FilePath
+versionedAppDir dflags = do
+ appdir <- getAppUserDataDirectory (programName dflags)
return $ appdir </> (TARGET_ARCH ++ '-':TARGET_OS ++ '-':cProjectVersion)
-- | The target code type of the compilation (if any).
@@ -3771,7 +3771,7 @@ interpretPackageEnv dflags = do
namedEnvPath :: String -> MaybeT IO FilePath
namedEnvPath name = do
- appdir <- liftMaybeT $ versionedAppDir
+ appdir <- liftMaybeT $ versionedAppDir dflags
return $ appdir </> "environments" </> name
loadEnvName :: String -> MaybeT IO String
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs
index e081a31..dec7b5b 100644
--- a/compiler/main/Packages.hs
+++ b/compiler/main/Packages.hs
@@ -354,10 +354,9 @@ getPackageConfRefs dflags = do
resolvePackageConfig :: DynFlags -> PkgConfRef -> IO (Maybe FilePath)
resolvePackageConfig dflags GlobalPkgConf = return $ Just (systemPackageConfig dflags)
-resolvePackageConfig _ UserPkgConf = handleIO (\_ -> return Nothing) $ do
- dir <- versionedAppDir
+resolvePackageConfig dflags UserPkgConf = handleIO (\_ -> return Nothing) $ do
+ dir <- versionedAppDir dflags
let pkgconf = dir </> "package.conf.d"
-
exist <- doesDirectoryExist pkgconf
return $ if exist then Just pkgconf else Nothing
resolvePackageConfig _ (PkgConfFile name) = return $ Just name
More information about the ghc-commits
mailing list