@@ -1448,10 +1448,14 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node):
1448
1448
def generate_compat_includes (output_dir : Path , target_dir : Path ):
1449
1449
file_types_mapping_godot_cpp_gen = map_header_files (target_dir / "include" )
1450
1450
file_types_mapping_godot_cpp = map_header_files (output_dir / "include" ) | file_types_mapping_godot_cpp_gen
1451
- godot_compat = output_dir / "output_header_mapping_godot.json"
1452
- if not godot_compat .exists ():
1453
- print ("Skipping godot_compat" )
1454
- return
1451
+ godot_compat = Path ("output_header_mapping_godot.json" )
1452
+ levels_to_look_back = 3
1453
+ while not godot_compat .exists ():
1454
+ godot_compat = ".." / godot_compat
1455
+ levels_to_look_back -= 1
1456
+ if levels_to_look_back == 0 :
1457
+ print ("Skipping godot_compat" )
1458
+ return
1455
1459
with godot_compat .open () as file :
1456
1460
mapping2 = json .load (file )
1457
1461
# Match the headers
@@ -1478,8 +1482,8 @@ def generate_compat_includes(output_dir: Path, target_dir: Path):
1478
1482
result .append (f"#endif" )
1479
1483
result .append ("" )
1480
1484
result .append (f"#endif // ! { header_guard } " )
1481
- # with header_filepath.open("w+", encoding="utf-8") as header_file:
1482
- # header_file.write("\n".join(result))
1485
+ with header_filepath .open ("w+" , encoding = "utf-8" ) as header_file :
1486
+ header_file .write ("\n " .join (result ))
1483
1487
1484
1488
1485
1489
def generate_engine_class_header (class_api , used_classes , fully_used_classes , use_template_get_node ):
0 commit comments