@ -62,27 +62,36 @@ let load_data serializer path zip_library =
(* * list of the zip files to search for specs files *)
(* * list of the zip files to search for specs files *)
let zip_libraries =
let zip_libraries =
let mk_zip_lib models zip_filename =
(* delay until load is called, to avoid stating/opening files at init time *)
{ models ; zip_filename ; zip_channel = lazy ( Zip . open_in zip_filename ) } in
lazy (
let zip_libs =
let mk_zip_lib models zip_filename =
if Config . use_jar_cache && Config . infer_cache < > None then
{ models ; zip_filename ; zip_channel = lazy ( Zip . open_in zip_filename ) } in
[]
let zip_libs =
else
if Config . use_jar_cache && Config . infer_cache < > None then
(* Order matters, jar files should appear in the order in which they should be searched for
[]
specs files . Config . specs_library is in reverse order of appearance on command line . * )
else
let add_zip zip_libs fname =
(* Order matters, jar files should appear in the order in which they should be searched for
if Filename . check_suffix fname " .jar " then
specs files . Config . specs_library is in reverse order of appearance on command line . * )
(* fname is a zip of specs *)
let add_zip zip_libs fname =
( mk_zip_lib false fname ) :: zip_libs
if Filename . check_suffix fname " .jar " then
else
(* fname is a zip of specs *)
(* fname is a dir of specs *)
( mk_zip_lib false fname ) :: zip_libs
zip_libs in
else
IList . fold_left add_zip [] Config . specs_library in
(* fname is a dir of specs *)
match Config . models_file with
zip_libs in
| None ->
IList . fold_left add_zip [] Config . specs_library in
zip_libs
let add_models file =
| Some file ->
( mk_zip_lib true file ) :: zip_libs in
( mk_zip_lib true file ) :: zip_libs
match Config . models_file with
| _ when Config . checkers ->
zip_libs
| Some file ->
add_models file
| None when Sys . file_exists Config . models_jar ->
add_models Config . models_jar
| None ->
zip_libs
)
(* Search path in the list of zip libraries and use a cache directory to save already
(* Search path in the list of zip libraries and use a cache directory to save already
deserialized data * )
deserialized data * )
@ -93,4 +102,4 @@ let load serializer path =
let opt = load_data serializer path zip_library in
let opt = load_data serializer path zip_library in
if Option . is_some opt then opt
if Option . is_some opt then opt
else loop other_libraries in
else loop other_libraries in
loop zip_libraries
loop ( Lazy . force zip_libraries )