@@ -33,7 +33,7 @@ let why3dflconf = Filename.concat XDG.home "why3.conf"
3333(* -------------------------------------------------------------------- *)
3434type pconfig = {
3535 pc_why3 : string option ;
36- pc_ini : string option ;
36+ pc_ini : string list ;
3737 pc_loadpath : (EcLoader .namespace option * string ) list ;
3838}
3939
@@ -63,10 +63,17 @@ let print_config config =
6363 | Some f -> Format. eprintf " %s@\n %!" f end ;
6464
6565 (* Print EC configuration file location *)
66+ Format. eprintf " EasyCrypt system configuration directory@\n %!" ;
67+ Format. eprintf " %s@\n %!" Sites. config;
68+
6669 Format. eprintf " EasyCrypt configuration file@\n %!" ;
6770 begin match config.pc_ini with
68- | None -> Format. eprintf " <none>@\n %!"
69- | Some f -> Format. eprintf " %s@\n %!" f end ;
71+ | [] -> Format. eprintf " <none>@\n %!"
72+ | names ->
73+ List. iter
74+ (fun name -> Format. eprintf " %s@\n %!" name)
75+ names
76+ end ;
7077
7178 (* Print list of known provers *)
7279 begin
@@ -117,8 +124,8 @@ let main () =
117124 let (module Sites ) = EcRelocate. sites in
118125
119126 (* Parse command line arguments *)
120- let conffile , options =
121- let conffile =
127+ let conffiles , options =
128+ let sysfile =
122129 let xdgini =
123130 XDG.Config. file
124131 ~exists: true ~mode: `All ~appname: EcVersion. app
@@ -131,6 +138,19 @@ let main () =
131138 if Sys. file_exists conffile then Some conffile else None ) in
132139 List.Exceptionless. hd (Option. to_list localini @ xdgini) in
133140
141+ let partfiles =
142+ if Sys. file_exists Sites. config then
143+ Sys. readdir Sites. config
144+ |> Array. to_seq
145+ |> Seq. filter (fun name -> String. lowercase_ascii (Filename. extension name) = " .conf" )
146+ |> Seq. map (Filename. concat Sites. config)
147+ |> Seq. filter (fun p -> Sys. file_exists p && not (Sys. is_directory p))
148+ |> List. of_seq
149+ |> List. sort String. compare
150+ else [] in
151+
152+ let conffiles = List. ocons sysfile partfiles in
153+
134154 let projfile (path : string option ) =
135155 let rec find (path : string ) : string option =
136156 let projfile = Filename. concat path projname in
@@ -168,11 +188,12 @@ let main () =
168188
169189 let getini (path : string option ) =
170190 let inisys =
171- Option. bind conffile (fun conffile ->
172- Option. map
173- (fun ini -> { inic_ini = ini; inic_root = None ; })
174- (read_ini_file conffile)
175- )
191+ List. filter_map
192+ (fun conffile ->
193+ Option. map
194+ (fun ini -> { inic_ini = ini; inic_root = None ; })
195+ (read_ini_file conffile))
196+ conffiles
176197 in
177198
178199 let iniproj =
@@ -186,9 +207,9 @@ let main () =
186207 )
187208 in
188209
189- List. filter_map identity [ iniproj; inisys] in
210+ List. ocons iniproj inisys in
190211
191- (conffile , EcOptions. parse_cmdline ~ini: getini Sys. argv) in
212+ (conffiles , EcOptions. parse_cmdline ~ini: getini Sys. argv) in
192213
193214 (* Execution of eager commands *)
194215 begin
@@ -400,7 +421,7 @@ let main () =
400421 | `Config ->
401422 let config = {
402423 pc_why3 = why3conf;
403- pc_ini = conffile ;
424+ pc_ini = conffiles ;
404425 pc_loadpath = EcCommands. loadpath () ;
405426 } in
406427
0 commit comments