Commit 833da5e2 authored by Adam Gundry's avatar Adam Gundry

Prevent bogus warning in cabal exec

variables contain colon-separated lists of package DBs, so it doesn't
make sense to call doesDirectoryExist on the colon-separated list.
Instead, this just checks for the existence of the sandbox package DB.
parent a447de51
......@@ -14,8 +14,6 @@ module Distribution.Client.Exec ( exec
import Control.Monad (unless)
import Data.Foldable (forM_)
import qualified Distribution.Simple.GHC as GHC
import qualified Distribution.Simple.GHCJS as GHCJS
......@@ -91,22 +89,19 @@ sandboxEnvironment verbosity sandboxDir comp platform programDb =
let Just program = lookupProgram hcProgram programDb
gDb <- getGlobalPackageDB verbosity program
sandboxConfigFilePath <- getSandboxConfigFilePath mempty
let compilerPackagePath = hcPackagePath gDb
let sandboxPackagePath = sandboxPackageDBPath sandboxDir comp platform
compilerPackagePaths = prependToSearchPath gDb sandboxPackagePath
-- Packages database must exist, otherwise things will start
-- failing in mysterious ways.
forM_ compilerPackagePath $ \fp -> do
exists <- doesDirectoryExist fp
unless exists $ warn verbosity $ "Package database is not a directory: " ++ fp
exists <- doesDirectoryExist sandboxPackagePath
unless exists $ warn verbosity $ "Package database is not a directory: "
++ sandboxPackagePath
-- Build the environment
return [ (packagePathEnvVar, compilerPackagePath)
, ("CABAL_SANDBOX_PACKAGE_PATH", compilerPackagePath)
return [ (packagePathEnvVar, Just compilerPackagePaths)
, ("CABAL_SANDBOX_PACKAGE_PATH", Just compilerPackagePaths)
, ("CABAL_SANDBOX_CONFIG", Just sandboxConfigFilePath)
hcPackagePath gDb =
let s = sandboxPackageDBPath sandboxDir comp platform
in Just $ prependToSearchPath gDb s
prependToSearchPath path newValue =
newValue ++ [searchPathSeparator] ++ path
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