cleanup locateRunfiles jank

This commit is contained in:
Sofia Faro 2020-12-14 14:48:49 +00:00
parent f9f03597e8
commit 82552003ae

View File

@ -432,18 +432,13 @@ setImports paths dflags = dflags { importPaths = paths }
locateGhcVersionHeader :: IO GhcVersionHeader
locateGhcVersionHeader = GhcVersionHeader <$> do
resourcesDir <- locateRunfiles (mainWorkspace </> "compiler" </> "damlc" </> "ghcversion.h")
isDirectory <- doesDirectoryExist resourcesDir
let path | isDirectory = resourcesDir </> "ghcversion.h"
| otherwise = resourcesDir
pure path
resourcesDir <- locateRunfiles (mainWorkspace </> "compiler" </> "damlc")
pure (resourcesDir </> "ghcversion.h")
locateCppPath :: IO (Maybe FilePath)
locateCppPath = do
resourcesDir <- locateRunfiles (mainWorkspace </> "compiler" </> "damlc" </> "hpp")
isDirectory <- doesDirectoryExist resourcesDir
let path | isDirectory = resourcesDir </> "hpp"
| otherwise = resourcesDir
resourcesDir <- locateRunfiles (mainWorkspace </> "compiler" </> "damlc")
let path = resourcesDir </> "hpp"
exists <- doesFileExist path
pure (guard exists >> Just path)