diff --git a/VisualC/examples/generate.py b/VisualC/examples/generate.py index 5052512342..85b249121a 100644 --- a/VisualC/examples/generate.py +++ b/VisualC/examples/generate.py @@ -4,7 +4,7 @@ import uuid REPOSITORY_ROOT = pathlib.Path(__file__).parent.parent.parent -def generate(x, y): +def generate(category, example_name): guid = str(uuid.uuid4()).upper() text = f""" @@ -15,31 +15,31 @@ def generate(x, y): - - + + """.strip() - file_name = REPOSITORY_ROOT / "VisualC" / "examples" / x / y / f"{y}.vcxproj" - - if file_name.exists(): - print("Skipping:", file_name) + project_file = REPOSITORY_ROOT / "VisualC" / "examples" / category / example_name / f"{example_name}.vcxproj" + + if project_file.exists(): + print("Skipping:", project_file) return - print("Generating file:", file_name) - os.makedirs(file_name.parent, exist_ok=True) - with open(file_name, "w", encoding="utf-8") as f: + print("Generating file:", project_file) + os.makedirs(project_file.parent, exist_ok=True) + with open(project_file, "w", encoding="utf-8") as f: f.write(text) def main(): path = REPOSITORY_ROOT / "examples" - for x in path.iterdir(): - if x.is_dir(): - for y in x.iterdir(): - generate(x.name, y.name) + for category in path.iterdir(): + if category.is_dir(): + for example in category.iterdir(): + generate(category.name, example.name) if __name__ == "__main__":