Commit 6392df07 authored by Edsko de Vries's avatar Edsko de Vries Committed by Austin Seipp

Don't hardcode the name "ghc" in versionedAppDir

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D618
parent 854e7b8e
......@@ -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"
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment