Skip to content
Snippets Groups Projects
Unverified Commit c25a2233 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov Committed by GitHub
Browse files

Merge pull request #5753 from hvr/pr/findexe-win32

Fix `--with-compiler` failing to locate compiler on Windows
parents 202b3ed2 a0d7bc80
No related branches found
No related tags found
No related merge requests found
......@@ -102,7 +102,7 @@ findProgramOnSearchPath verbosity searchpath prog = do
-- On windows, getSystemSearchPath is not guaranteed 100% correct so we
-- use findExecutable and then approximate the not-found-at locations.
tryPathElem ProgramSearchPathDefault | buildOS == Windows = do
mExe <- findExecutable prog
mExe <- firstJustM [ findExecutable (prog <.> ext) | ext <- exeExtensions ]
syspath <- getSystemSearchPath
case mExe of
Nothing ->
......@@ -130,6 +130,15 @@ findProgramOnSearchPath verbosity searchpath prog = do
then return (Just f, reverse fs')
else go (f:fs') fs
-- Helper for evaluating actions until the first one returns 'Just'
firstJustM :: Monad m => [m (Maybe a)] -> m (Maybe a)
firstJustM [] = return Nothing
firstJustM (ma:mas) = do
a <- ma
case a of
Just _ -> return a
Nothing -> firstJustM mas
-- | Interpret a 'ProgramSearchPath' to construct a new @$PATH@ env var.
-- Note that this is close but not perfect because on Windows the search
-- algorithm looks at more than just the @%PATH%@.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment