aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2018-08-12 04:09:03 +0200
committerDaniel Gröber <dxld@darkboxed.org>2018-08-12 04:09:03 +0200
commit3d5f08a69d67e7770f0c6e134fe64bcfd7009ff2 (patch)
treee04e2c4a8930a4ca743e2a30024c30d0dd4c7562 /lib
parente2a41086c2b044f4d9c1276a920bba8e3eeb501c (diff)
Fix libexec path guessing when using new-build again
Diffstat (limited to 'lib')
-rw-r--r--lib/Distribution/Helper.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Distribution/Helper.hs b/lib/Distribution/Helper.hs
index 0c2adeb..3a49031 100644
--- a/lib/Distribution/Helper.hs
+++ b/lib/Distribution/Helper.hs
@@ -501,10 +501,11 @@ tryFindCabalHelperTreeDistDir :: IO (Maybe FilePath)
tryFindCabalHelperTreeDistDir = do
exe <- canonicalizePath =<< getExecutablePath'
mplan <- findPlanJson exe
+ let mdistdir = takeDirectory . takeDirectory <$> mplan
cwd <- getCurrentDirectory
let candidates = sortBy (compare `on` ddType) $ concat
- [ maybeToList $ DistDir NewBuildDist <$> mplan
+ [ maybeToList $ DistDir NewBuildDist <$> mdistdir
, [ DistDir OldBuildDist $ (!!3) $ iterate takeDirectory exe ]
, if takeFileName exe == "ghc" -- we're probably in ghci; try CWD
then [ DistDir NewBuildDist $ cwd </> "dist-newstyle"
@@ -539,7 +540,10 @@ toOldBuildDistDir (DistDir NewBuildDist dir) = do
isCabalHelperUnit
Unit { uPId = PkgId (PkgName n) _
, uType = UnitTypeLocal
- } | n == "cabal-helper" = True
+ , uComps
+ } | n == "cabal-helper" &&
+ Map.member (CompNameExe "cabal-helper-wrapper") uComps
+ = True
isCabalHelperUnit _ = False
toOldBuildDistDir x = return $ Just x