From 0c621f842c3905b3f7b769fd6ee23efc188d16a4 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 5 Oct 2017 16:24:27 +0200 Subject: o Make directory before creating files. --- py/kicad_gerber.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/py/kicad_gerber.py b/py/kicad_gerber.py index c6f6e4b..f57be9a 100755 --- a/py/kicad_gerber.py +++ b/py/kicad_gerber.py @@ -103,7 +103,16 @@ for layerNum in layers.CuStack(): pctl = PLOT_CONTROLLER(board) popt = pctl.GetPlotOptions() -popt.SetOutputDirectory(args.output_directory) + +output_directory = args.output_directory +popt.SetOutputDirectory(output_directory) + +if not os.path.isdir(output_directory): + try: + os.makedirs(output_directory) + except: + print("Could not make output directory", file=sys.stderr) + sys.exit(1) # A nasty hack to get the base filename pctl.SetLayer(F_Cu) -- cgit v1.2.3