Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
6b06b6ca
Commit
6b06b6ca
authored
Nov 10, 2013
by
Mikhail Glushenkov
Browse files
Work around 'findExecutable' being buggy on Windows.
parent
2e26b84c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Cabal/Distribution/Simple/Program/Find.hs
View file @
6b06b6ca
...
...
@@ -91,19 +91,31 @@ findProgramOnSearchPath verbosity searchpath prog = do
Windows
->
[
""
,
"exe"
]
_
->
[
""
]
tryPathElem
ProgramSearchPathDefault
=
findExecutable
prog
tryPathElem
ProgramSearchPathDefault
=
do
-- 'findExecutable' doesn't check that the path really refers to an
-- executable on Windows (at least with GHC < 7.8). See
-- https://ghc.haskell.org/trac/ghc/ticket/2184
mExe
<-
findExecutable
prog
case
mExe
of
Just
exe
->
do
isExe
<-
checkExe
exe
if
isExe
then
return
mExe
else
return
Nothing
_
->
return
mExe
findFirstExe
[]
=
return
Nothing
findFirstExe
(
f
:
fs
)
=
do
isExe
<-
checkExe
f
if
isExe
then
return
(
Just
f
)
else
findFirstExe
fs
checkExe
f
=
do
exists
<-
doesFileExist
f
if
exists
then
do
perms
<-
getPermissions
f
if
executable
perms
then
return
(
Just
f
)
else
findFirstExe
fs
else
findFirstExe
fs
return
(
executable
perms
)
else
return
False
-- | Interpret a 'ProgramSearchPath' to construct a new @$PATH@ env var.
-- Note that this is close but not perfect because on Windows the search
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment