From 3d5f08a69d67e7770f0c6e134fe64bcfd7009ff2 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sun, 12 Aug 2018 04:09:03 +0200 Subject: Fix libexec path guessing when using new-build again --- lib/Distribution/Helper.hs | 8 ++++++-- 1 file 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 -- cgit v1.2.3