[commit: ghc] ghc-7.10: Don't hardcode the name "ghc" in versionedAppDir (d33e2ff)

git at git.haskell.org git at git.haskell.org
Mon Jan 19 13:58:32 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/d33e2ffbe33a99252708a9761995109ddac04a7f/ghc

>---------------------------------------------------------------

commit d33e2ffbe33a99252708a9761995109ddac04a7f
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
    
    (cherry picked from commit 6392df07e89304a4daeb1af379c051b03a39cda7)


>---------------------------------------------------------------

d33e2ffbe33a99252708a9761995109ddac04a7f
 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 951db0e..dc2fd1c 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 a1b1400..c373fdf 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -1021,9 +1021,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).
@@ -3768,7 +3768,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