diff --git a/gen/gen.py b/gen/gen.py index 8b1c301..9cccdfc 100644 --- a/gen/gen.py +++ b/gen/gen.py @@ -1,7 +1,6 @@ import os -from turtledemo.sorting_animate import ssort -from jinja2 import PackageLoader, Environment, FileSystemLoader +from jinja2 import Environment, FileSystemLoader TemplateLoader = FileSystemLoader(os.path.abspath("../gen/template")) @@ -25,8 +24,9 @@ def word2number_gen(include_list): def code_gen(template_name): print("generator %s.c" % template_name) template = env.get_template("%s.c.j2" % template_name) - print(os.path.abspath("./gen/%s.c" % template_name)) - f = open("./gen/%s.c" % template_name, "w") + if not os.path.exists("./gen/"): + os.mkdir("./gen") + f = open("./gen/%s.c" % template_name, "w+") dir_list = os.listdir("../src/locale") include_list = [] for path in dir_list: