diff options
Diffstat (limited to 'bin/importer.ml')
-rw-r--r-- | bin/importer.ml | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/bin/importer.ml b/bin/importer.ml index 0da2ab7..260d83b 100644 --- a/bin/importer.ml +++ b/bin/importer.ml @@ -33,6 +33,7 @@ module Args = struct let load_conf : string -> ImporterSyntax.t = fun file -> + let dirname = Filename.dirname file in match Filename.extension file with | _ -> ( let (conf : (ImporterSyntax.t, string) result) = @@ -51,7 +52,16 @@ module Args = struct Error error_msg in - ImportConf.t_of_toml configuration_file + + ImportConf.t_of_toml + ~context: + { + checkFile = + (fun f -> Sys.file_exists (Filename.concat dirname f)); + loadFile = + (fun f -> Otoml.Parser.from_file (Filename.concat dirname f)); + } + configuration_file in match conf with | Error e -> @@ -238,14 +248,6 @@ let () = let sqlfile = Filename.concat dirname (prefix ^ ".sqlite") in let conf = { conf with mapping_date = creation_date sqlfile } in - (* Ensure that all the files exists *) - List.iter process_order ~f:(fun (mapping : Analyse.t) -> - let source = Analyse.table mapping in - (* First, check *) - if not (Sys.file_exists source.Table.file) then begin - ignore @@ exists @@ Filename.concat dirname source.Table.file - end); - (* The configuration is loaded and valid, we create the errors log file *) let log_error = ImportErrors.log ~with_bom:conf.bom prefix dirname in |