@@ -37,14 +37,17 @@ initScriptSession :: [String] -> IO (Either ScriptSessionError ScriptSession)
3737initScriptSession ghcPkgPaths = do
3838 --for the sake of convenience, for developers' builds, include the local cabal sandbox package database and the cabal new-build package database
3939 homeDir <- getHomeDirectory
40− sandboxPkgPaths <- liftM concat $ mapM glob [
41− "./dist-newstyle/packagedb/ghc-*",
42− ".cabal-sandbox/*packages.conf.d",
43− homeDir </> ".cabal/store/ghc-*/package.db"
44− ]
4540 let excHandler exc = pure $ Left (ScriptSessionLoadError exc)
4641 handleGhcException excHandler $ runGhc (Just libdir) $ do
4742 dflags <- getSessionDynFlags
43+ let ghcVersion = projectVersion dflags
44+
45+ sandboxPkgPaths <- liftIO $ liftM concat $ mapM glob [
46+ "./dist-newstyle/packagedb/ghc-" ++ ghcVersion,
47+ ".cabal-sandbox/*ghc-" ++ ghcVersion ++ "-packages.conf.d",
48+ homeDir </> ".cabal/store/ghc-" ++ ghcVersion ++ "/package.db"
49+ ]
50+
4851 let localPkgPaths = map PkgConfFile (ghcPkgPaths ++ sandboxPkgPaths)
4952
5053 let dflags' = applyGopts . applyXopts $ dflags { hscTarget = HscInterpreted ,