[Git][ghc/ghc][master] Include tried paths in findToolDir error
Marge Bot
gitlab at gitlab.haskell.org
Tue Dec 1 00:49:38 UTC 2020
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
b94a65af by jneira at 2020-11-30T19:49:31-05:00
Include tried paths in findToolDir error
- - - - -
1 changed file:
- compiler/GHC/SysTools/BaseDir.hs
Changes:
=====================================
compiler/GHC/SysTools/BaseDir.hs
=====================================
@@ -185,17 +185,19 @@ findToolDir
:: FilePath -- ^ topdir
-> IO (Maybe FilePath)
#if defined(mingw32_HOST_OS) && !defined(USE_INPLACE_MINGW_TOOLCHAIN)
-findToolDir top_dir = go 0 (top_dir </> "..")
+findToolDir top_dir = go 0 (top_dir </> "..") []
where maxDepth = 3
- go :: Int -> FilePath -> IO (Maybe FilePath)
- go k path
+ go :: Int -> FilePath -> [FilePath] -> IO (Maybe FilePath)
+ go k path tried
| k == maxDepth = throwGhcExceptionIO $
- InstallationError "could not detect mingw toolchain"
+ InstallationError $ "could not detect mingw toolchain in the following paths: " ++ show tried
| otherwise = do
- oneLevel <- doesDirectoryExist (path </> "mingw")
+ let try = path </> "mingw"
+ let tried = tried ++ [try]
+ oneLevel <- doesDirectoryExist try
if oneLevel
then return (Just path)
- else go (k+1) (path </> "..")
+ else go (k+1) (path </> "..") tried
#else
findToolDir _ = return Nothing
#endif
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b94a65afe1e270245cd5b9fe03d59b726dfba8c4
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b94a65afe1e270245cd5b9fe03d59b726dfba8c4
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201130/7469c1e3/attachment-0001.html>
More information about the ghc-commits
mailing list