Skip to content

Commit

Permalink
Fix #5210 Don't refer to index.html when Haddock will not create it
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem committed Oct 14, 2023
1 parent 9f37325 commit 45828f4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Cabal/src/Distribution/Simple/Haddock.hs
Original file line number Diff line number Diff line change
Expand Up @@ -821,14 +821,21 @@ renderArgs verbosity tmpFileOpts version comp platform args k = do
else k (renderedArgs, result)
where
outputDir = (unDir $ argOutputDir args)
isArgContents = isJust (flagToMaybe $ argContents args)
isArgIndex = isJust (flagToMaybe $ argIndex args)
isArgGenIndex = fromFlagOrDefault False (argGenIndex args)
-- Haddock, when generating HTML, does not generate an index if the options
-- --use-contents or --use-index are passed to it. See
-- https://haskell-haddock.readthedocs.io/en/latest/invoking.html#cmdoption-use-contents
isIndexGenerated = isArgGenIndex && (not isArgContents) && (not isArgIndex)
result =
intercalate ", "
. map
( \o ->
outputDir
</> case o of
Html
| fromFlagOrDefault False (argGenIndex args) ->
| isIndexGenerated ->
"index.html"
Html
| otherwise ->
Expand Down

0 comments on commit 45828f4

Please sign in to comment.