Skip to content

Commit c311f0e

Browse files
committed
Rename "find_in_path" into "which"
Signed-off-by: Christophe Troestler <[email protected]>
1 parent cc7d830 commit c311f0e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/configurator/v1.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ module Find_in_path = struct
118118
| None -> prog_not_found prog
119119
| Some fn -> fn
120120

121-
let find prog =
121+
let which prog =
122122
List.find_map (get_path ()) ~f:(fun dir ->
123123
let fn = dir ^/ prog ^ exe in
124124
Option.some_if (Sys.file_exists fn) fn)
@@ -470,9 +470,9 @@ const char *s%i = "BEGIN-%i-false-END";
470470
Sys.rename tmp_fname fname
471471
end
472472

473-
let find_in_path t prog =
474-
logf t "find_in_path: %s" prog;
475-
let x = Find_in_path.find prog in
473+
let which t prog =
474+
logf t "which: %s" prog;
475+
let x = Find_in_path.which prog in
476476
logf t "-> %s"
477477
(match x with
478478
| None -> "not found"
@@ -486,7 +486,7 @@ module Pkg_config = struct
486486
}
487487

488488
let get c =
489-
Option.map (find_in_path c "pkg-config") ~f:(fun pkg_config ->
489+
Option.map (which c "pkg-config") ~f:(fun pkg_config ->
490490
{ pkg_config; configurator = c })
491491

492492
type package_conf =
@@ -502,7 +502,7 @@ module Pkg_config = struct
502502
let env =
503503
match ocaml_config_var c "system" with
504504
| Some "macosx" -> begin
505-
match find_in_path c "brew" with
505+
match which c "brew" with
506506
| Some brew ->
507507
let prefix =
508508
String.trim (run_capture_exn c ~dir (command_line brew ["--prefix"]))

src/configurator/v1.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ module Flags : sig
118118
Any blank words are filtered out of the results. *)
119119
end
120120

121-
val find_in_path : t -> string -> string option
122-
(** [find_in_path t prog] seek [prog] in the PATH and return the name
121+
val which : t -> string -> string option
122+
(** [which t prog] seek [prog] in the PATH and return the name
123123
of the program prefixed with the first path where it is found.
124124
Return [None] the the program is not found. *)
125125

0 commit comments

Comments
 (0)