Commit a20fa9da authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

Initialise all subfields of 'install-dirs' in 'sandbox init'.

Inheriting e.g. 'libsubdir' from '~/.cabal/config' can break things if it set to
an empty string.

Fixes #1389.
parent d54b4374
......@@ -36,8 +36,9 @@ import Distribution.Client.Setup ( GlobalFlags(..), ConfigExFlags(..)
, InstallFlags(..)
, defaultSandboxLocation )
import Distribution.Simple.Compiler ( Compiler, PackageDB(..)
, showCompilerId )
, compilerFlavor, showCompilerId )
import Distribution.Simple.InstallDirs ( InstallDirs(..), PathTemplate
, defaultInstallDirs, combineInstallDirs
, fromPathTemplate, toPathTemplate )
import Distribution.Simple.Setup ( Flag(..), ConfigFlags(..),
fromFlagOrDefault, toFlag )
......@@ -175,9 +176,15 @@ basePackageEnvironment =
initialPackageEnvironment :: FilePath -> Compiler -> Platform
-> IO PackageEnvironment
initialPackageEnvironment sandboxDir compiler platform = do
defInstallDirs <- defaultInstallDirs (compilerFlavor compiler)
{- userInstall= -} False {- _hasLibs= -} False
let initialConfig = commonPackageEnvironmentConfig sandboxDir
installDirs = combineInstallDirs (\d f -> Flag $ fromFlagOrDefault d f)
defInstallDirs (savedUserInstallDirs initialConfig)
return $ mempty {
pkgEnvSavedConfig = initialConfig {
savedUserInstallDirs = installDirs,
savedGlobalInstallDirs = installDirs,
savedGlobalFlags = (savedGlobalFlags initialConfig) {
globalLocalRepos = [sandboxDir </> "packages"]
},
......
Supports Markdown
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