File tree 1 file changed +17
-1
lines changed
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 2
2
(* Tests of in and out channels *)
3
3
(* ********************************************************************** *)
4
4
5
+ (* Try to find a text file rather than a binary to test In_channel, so
6
+ that input_line makes more sense *)
7
+ let in_file =
8
+ let path0 = Filename. dirname Sys. executable_name
9
+ and up p = Filename. concat p Filename. parent_dir_name
10
+ and candidate p = Filename. concat p " dune" in
11
+ let path1 = up path0 in
12
+ let path2 = up path1 in
13
+ let path3 = up path2 in
14
+ let path4 = up path3 in
15
+ let candidates = List. map candidate [ path0; path1; path2; path3; path4 ] in
16
+ let existing = List. filter Sys. file_exists candidates in
17
+ match existing with
18
+ | [] -> Sys. executable_name
19
+ | f :: _ -> f
20
+
5
21
module ICConf : Lin .Spec = struct
6
22
type t = In_channel .t
7
23
8
- let init () = In_channel. open_bin Sys. executable_name
24
+ let init () = In_channel. open_bin in_file
9
25
let cleanup = In_channel. close
10
26
11
27
open Lin
You can’t perform that action at this time.
0 commit comments