@@ -2,9 +2,9 @@ open Kicadsch
22module SvgSchPainter = MakeSchPainter (SvgPainter )
33open SvgSchPainter
44
5- let process_file init sch =
5+ let process_file init outdir sch =
66 let slen = String. length sch in
7- let fileout = (String. sub sch 0 (slen - 4 )) ^ " .svg" in
7+ let fileout = outdir ^ " / " ^ (String. sub sch 0 (slen - 4 )) ^ " .svg" in
88 let % lwt o = Lwt_io. open_file ~mode: Lwt_io. Output fileout in
99 let % lwt i = Lwt_io. open_file ~mode: Lwt_io. Input sch in
1010 let % lwt endcontext = Lwt_stream. fold parse_line (Lwt_io. read_lines i) init in
@@ -19,13 +19,15 @@ let process_libs libs =
1919let () =
2020 let files = ref [] in
2121 let libs = ref [] in
22+ let outpath = ref " " in
2223 let speclist = [
2324 (" -l" , Arg. String (fun lib -> libs := lib::! libs), " specify component library" );
24- (" -f" , Arg. String (fun sch -> files := sch::! files), " sch file to process" )] in
25+ (" -f" , Arg. String (fun sch -> files := sch::! files), " sch file to process" );
26+ (" -o" , Arg. String (fun o -> outpath := o), " full path of output directory" )] in
2527 let usage_msg = " plotkicadsch prints Kicad sch files to svg" in
2628 Arg. parse speclist print_endline usage_msg;
2729 Lwt_main. run
2830 begin
2931 let % lwt c = process_libs ! libs in
30- Lwt_list. iter_p (process_file c) ! files
32+ Lwt_list. iter_p (process_file c ! outpath ) ! files
3133 end
0 commit comments