Skip to content

Commit

Permalink
Fix haddocks for global packages on Windows (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
borsboom committed Jun 23, 2015
1 parent 9036cc7 commit 0f709fa
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Stack/GhcPkg.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import Prelude hiding (FilePath)
import Stack.Build.Types (StackBuildException (Couldn'tFindPkgId))
import Stack.Constants
import Stack.Types
import System.Directory (createDirectoryIfMissing, doesDirectoryExist, canonicalizePath)
import System.FilePath (normalise)
import System.Directory (createDirectoryIfMissing, doesDirectoryExist, canonicalizePath,
doesDirectoryExist)
import System.Process.Read

-- | Get the global package database
Expand Down Expand Up @@ -137,7 +137,13 @@ findGhcPkgHaddockHtml :: (MonadIO m, MonadLogger m, MonadBaseControl IO m, Monad
findGhcPkgHaddockHtml menv pkgDbs pkgId = do
mpath <- findGhcPkgField menv pkgDbs (packageIdentifierText pkgId) "haddock-html"
case mpath of
Just !path -> return $ parseAbsDir $ normalise $ T.unpack path
Just !path0 -> do
let path = T.unpack path0
exists <- liftIO $ doesDirectoryExist path
path' <- if exists
then liftIO $ canonicalizePath path
else return path
return (parseAbsDir path')
_ -> return Nothing

-- | Get the dependencies of the package.
Expand Down

0 comments on commit 0f709fa

Please sign in to comment.