From ab2723757f41fc9a06867a673cacab27537cf8cf Mon Sep 17 00:00:00 2001 From: molingyu Date: Thu, 5 Sep 2024 03:07:00 +0800 Subject: [PATCH] fix: gen.py --- gen/gen.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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: