aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
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