66 """
67 @brief Create a new Rendering Engine user application.
68
69 Generates the project folder structure and copies template files.
70 Projects created in the default UserApplications directory are
71 automatically registered in UserApplications/CMakeLists.txt.
72
73 @param name Name of the project to create.
74 @param destination Directory in which the project will be created.
75 """
76 destination = os.path.abspath(destination)
77 default_destination = os.path.abspath(DEST_ROOT)
78 project_dir = os.path.join(destination, name)
79
80 if os.path.exists(project_dir):
81 print(f"Error: Project '{name}' already exists at '{project_dir}'.")
82 return
83
84 os.makedirs(project_dir)
85 copy_template(TEMPLATE_ROOT, project_dir, name)
86
87 if destination == default_destination:
88 file_path = os.path.join(default_destination, "CMakeLists.txt")
89 cmake_add_project = "\n" + "add_subdirectory(" + name + ")"
90
91 with open(file_path, "a") as cmake_file:
92 cmake_file.write(cmake_add_project)
93 else:
95 print(
96 f"Warning: Project '{name}' was created successfully, "
97 "but could not be registered."
98 )
99 return
100
101 print(f"Created new project at {project_dir}")
102