mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-04-04 22:42:28 +02:00
generator.py makes the "generated" folder if it doesn't exist
This commit is contained in:
parent
27a60e7b71
commit
62c45a8ebd
12
generator.py
12
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<Element> 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<Element> 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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user