Commit 829a00e7 authored by Vít Šefl's avatar Vít Šefl

Add getGhcAppDir to Distribution.Simple.GHC

parent 081130e6
......@@ -51,6 +51,7 @@ module Distribution.Simple.GHC (
registerPackage,
componentGhcOptions,
componentCcGhcOptions,
getGhcAppDir,
getLibDir,
isDynamic,
getGlobalPackageDB,
......@@ -366,6 +367,10 @@ toPackageIndex verbosity pkgss progdb = do
where
ghcProg = fromMaybe (error "GHC.toPackageIndex: no ghc program") $ lookupProgram ghcProgram progdb
-- | Return the 'FilePath' to the GHC application data directory.
getGhcAppDir :: IO FilePath
getGhcAppDir = getAppUserDataDirectory "ghc"
getLibDir :: Verbosity -> LocalBuildInfo -> IO FilePath
getLibDir verbosity lbi =
dropWhileEndLE isSpace `fmap`
......@@ -391,7 +396,7 @@ getUserPackageDB _verbosity ghcProg platform = do
-- It's rather annoying that we have to reconstruct this, because ghc
-- hides this information from us otherwise. But for certain use cases
-- like change monitoring it really can't remain hidden.
appdir <- getAppUserDataDirectory "ghc"
appdir <- getGhcAppDir
return (appdir </> platformAndVersion </> packageConfFileName)
where
platformAndVersion = Internal.ghcPlatformAndVersionString
......
......@@ -109,7 +109,7 @@ import Distribution.Simple.Compiler
( Compiler(..), CompilerId(..), CompilerFlavor(..)
, PackageDBStack )
import Distribution.Simple.GHC
( ghcPlatformAndVersionString
( ghcPlatformAndVersionString, getGhcAppDir
, GhcImplInfo(..), getImplInfo
, GhcEnvironmentFileEntry(..)
, renderGhcEnvironmentFile, readGhcEnvironmentFile, ParseErrorExc )
......@@ -146,7 +146,7 @@ import Distribution.Utils.NubList
( fromNubList )
import Network.URI (URI)
import System.Directory
( getAppUserDataDirectory, doesFileExist, createDirectoryIfMissing
( doesFileExist, createDirectoryIfMissing
, getTemporaryDirectory, makeAbsolute, doesDirectoryExist
, removeFile, removeDirectory, copyFile )
import System.FilePath
......@@ -850,7 +850,7 @@ entriesForLibraryComponents = Map.foldrWithKey' (\k v -> mappend (go k v)) []
-- | Gets the file file path to the request environment file.
getEnvFile :: ClientInstallFlags -> Platform -> Version -> IO FilePath
getEnvFile clientInstallFlags platform compilerVersion = do
appData <- getAppUserDataDirectory "ghc"
appData <- getGhcAppDir
case flagToMaybe (cinstEnvironmentPath clientInstallFlags) of
Just spec
-- Is spec a bare word without any "pathy" content, then it refers to
......
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