Skip to content

Commit

Permalink
Handle Windows build env case too
Browse files Browse the repository at this point in the history
Signed-off-by: Athish Pranav D <athishanna@gmail.com>
  • Loading branch information
Athishpranav2003 committed Aug 28, 2024
1 parent 6487983 commit 50b4df9
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions bin/exec.ml
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,27 @@ let get_path_and_build_if_necessary sctx ~no_rebuild ~dir ~prog =
| Some path -> build_prog ~no_rebuild ~prog path
| None -> not_found ~dir ~prog)
| Absolute ->
(match
let path = Path.of_string prog in
if Path.exists path
then Some path
else if not Sys.win32
then Some (Path.relative_to_source_in_build_or_external ~dir prog)
else (
let prog = Path.extend_basename path ~suffix:Bin.exe in
Option.some_if (Path.exists prog) prog)
with
| Some prog -> Memo.return prog
| None -> not_found ~dir ~prog)
let path = Path.of_string prog in
if Path.exists path
then Memo.return path
else (
let path = Path.relative_to_source_in_build_or_external ~dir prog in
Build_system.file_exists path
>>= (function
| true -> Memo.return (Some path)
| false ->
if not (Filename.check_suffix prog ".exe")
then Memo.return None
else (
let path = Path.extend_basename path ~suffix:".exe" in
Build_system.file_exists path
>>| function
| true -> Some path
| false -> None))
>>= (function
| Some path -> Memo.return path
| None -> not_found ~dir ~prog)
)
;;

module Exec_context = struct
Expand Down

0 comments on commit 50b4df9

Please sign in to comment.