diff --git a/cabal-install/Distribution/Client/CmdInstall.hs b/cabal-install/Distribution/Client/CmdInstall.hs index 2a09baa26c117e9796d4e49fd7224edc3309951b..2377ffa2193e0da44168e22bf085647d9e44a9b4 100644 --- a/cabal-install/Distribution/Client/CmdInstall.hs +++ b/cabal-install/Distribution/Client/CmdInstall.hs @@ -146,7 +146,7 @@ import Distribution.Utils.NubList ( fromNubList ) import Network.URI (URI) import System.Directory - ( getHomeDirectory, doesFileExist, createDirectoryIfMissing + ( getAppUserDataDirectory, doesFileExist, createDirectoryIfMissing , getTemporaryDirectory, makeAbsolute, doesDirectoryExist , removeFile, removeDirectory, copyFile ) import System.FilePath @@ -850,13 +850,13 @@ 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 - home <- getHomeDirectory + appData <- getAppUserDataDirectory "ghc" case flagToMaybe (cinstEnvironmentPath clientInstallFlags) of Just spec -- Is spec a bare word without any "pathy" content, then it refers to -- a named global environment. | takeBaseName spec == spec -> - return (getGlobalEnv home platform compilerVersion spec) + return (getGlobalEnv appData platform compilerVersion spec) | otherwise -> do spec' <- makeAbsolute spec isDir <- doesDirectoryExist spec' @@ -867,7 +867,7 @@ getEnvFile clientInstallFlags platform compilerVersion = do -- Otherwise, treat it like a literal file path. else return spec' Nothing -> - return (getGlobalEnv home platform compilerVersion "default") + return (getGlobalEnv appData platform compilerVersion "default") -- | Returns the list of @GhcEnvFilePackageIj@ values already existing in the -- environment being operated on. @@ -891,8 +891,8 @@ getExistingEnvEntries verbosity compilerFlavor supportsPkgEnvFiles envFile = do -- -- TODO(m-renaud): Create PkgEnvName newtype wrapper. getGlobalEnv :: FilePath -> Platform -> Version -> String -> FilePath -getGlobalEnv home platform compilerVersion name = - home ".ghc" ghcPlatformAndVersionString platform compilerVersion +getGlobalEnv appData platform compilerVersion name = + appData ghcPlatformAndVersionString platform compilerVersion "environments" name -- | Constructs the path to a local GHC environment file.