diff options
Diffstat (limited to 'tooling/mk_fwrk.py')
| -rwxr-xr-x | tooling/mk_fwrk.py | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/tooling/mk_fwrk.py b/tooling/mk_fwrk.py index 9bc132e6..89857347 100755 --- a/tooling/mk_fwrk.py +++ b/tooling/mk_fwrk.py @@ -5,7 +5,10 @@ import os import json import sys -def create_directory_structure(base_path, project_name): +""" + Create directory structure for the framework. +""" +def create_directory_structure(base_path_fwrk, project_file_name, project_name): # Define the directory structure structure = { project_name: { @@ -20,12 +23,12 @@ def create_directory_structure(base_path, project_name): ".keep": None }, ".keep": None, - f"{project_name}.json": {} + f"{project_file_name}.json": {} } } - def create_structure(path, structure): - for name, content in structure.items(): + def create_structure(path, structure_in): + for name, content in structure_in.items(): current_path = os.path.join(path, name) # Create directories or files based on the content type if isinstance(content, dict) and current_path.endswith(".json") == False: @@ -37,18 +40,18 @@ def create_directory_structure(base_path, project_name): pass # Create the base directory - os.makedirs(base_path, exist_ok=True) - create_structure(base_path, structure) + os.makedirs(base_path_fwrk, exist_ok=True) + create_structure(base_path_fwrk, structure) # Create the JSON file - proj_json_path = os.path.join(base_path, project_name, f"{project_name}.json") + proj_json_path = os.path.join(base_path_fwrk, project_name, f"{project_file_name}.json") manifest = { "compiler_path": "clang++", "compiler_std": "c++20", "headers_path": ["./", "../../../dev/kernel", "../../../public/frameworks/", "../../../dev/", "./"], "sources_path": [ - + ], "output_name": f"./dist/{project_name}", "cpp_macros": [ @@ -58,13 +61,13 @@ def create_directory_structure(base_path, project_name): "__NE_SDK__" ] } - + with open(proj_json_path, 'w') as json_file: json.dump(manifest, json_file, indent=4) - proj_cpp_path = os.path.join(base_path, project_name, f"src/CommandLine.cc") + proj_cpp_path = os.path.join(base_path_fwrk, project_name, f"src/CommandLine.cc") - cpp_file = "#include <user/SystemCalls.h>\n\nSInt32 _NeMain(SInt32 argc, Char* argv[]) {\n\treturn EXIT_FAILURE;\n}" + cpp_file = "#include <user/SystemCalls.h>\n\nSInt32 _DylibAttach(SInt32 argc, Char* argv[]) {\n\treturn EXIT_FAILURE;\n}" with open(proj_cpp_path, 'w') as cpp_file_io: cpp_file_io.write(cpp_file) @@ -75,6 +78,6 @@ if __name__ == "__main__": sys.exit(os.EX_CONFIG) base_path = os.getcwd() # Use the current working directory as the base path - create_directory_structure(base_path, sys.argv[1]) - - print("NeKernel framework created successfully.") + create_directory_structure(base_path, sys.argv[1], sys.argv[1] + '.fwrk') + + print("NeKernel Framework created successfully.") |
