From 62c45a8ebd8089aa315fcf656d548ea70ababfec Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sun, 17 Feb 2013 12:07:33 -0500 Subject: [PATCH] generator.py makes the "generated" folder if it doesn't exist --- generator.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/generator.py b/generator.py index 16407b4f6..35c4d2c13 100644 --- a/generator.py +++ b/generator.py @@ -2,8 +2,8 @@ import re, os, shutil, string, sys def generateElements(elementFiles, outputCpp, outputH): - elementClasses = dict() - baseClasses = dict() + elementClasses = {} + baseClasses = {} elementHeader = """#ifndef ELEMENTCLASSES_H #define ELEMENTCLASSES_H @@ -120,6 +120,8 @@ std::vector GetElements() } """; + if not os.path.exists(outputH.split("/")[1]): + os.makedirs(outputH.split("/")[1]) f = open(outputH, "w") f.write(elementHeader) f.close() @@ -129,7 +131,7 @@ std::vector GetElements() f.close() def generateTools(toolFiles, outputCpp, outputH): - toolClasses = dict() + toolClasses = {} toolHeader = """#ifndef TOOLCLASSES_H #define TOOLCLASSES_H @@ -193,7 +195,9 @@ def generateTools(toolFiles, outputCpp, outputH): toolContent += """ return tools; } """; - + + if not os.path.exists(outputH.split("/")[1]): + os.makedirs(outputH.split("/")[1]) f = open(outputH, "w") f.write(toolHeader) f.close()