aboutsummaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rwxr-xr-xpy/kicad_gerber.py11
1 files changed, 10 insertions, 1 deletions
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)