@@ -423,7 +423,7 @@ def generate_bindings(api_filepath, use_template_get_node, bits="64", precision=
423
423
generate_engine_classes_bindings (api , target_dir , use_template_get_node )
424
424
generate_utility_functions (api , target_dir )
425
425
if godot_repo != "" :
426
- generate_compat_includes (godot_repo , target_dir )
426
+ generate_compat_includes (godot_repo , output_dir , target_dir )
427
427
428
428
429
429
CLASS_ALIASES = {
@@ -1567,19 +1567,19 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node):
1567
1567
header_file .write ("\n " .join (result ))
1568
1568
1569
1569
1570
- def generate_compat_includes (godot_repo : Path , target_dir : Path ):
1571
- file_types_mapping_godot_cpp_gen = map_header_files (target_dir / "include" )
1570
+ def generate_compat_includes (godot_repo : Path , output_dir : Path , target_dir : Path ):
1571
+ file_types_mapping_godot_cpp_gen = map_header_files (output_dir )
1572
1572
file_types_mapping_godot = map_header_files (godot_repo )
1573
1573
# Match the headers
1574
1574
file_types_mapping = match_headers (file_types_mapping_godot_cpp_gen , file_types_mapping_godot )
1575
1575
1576
- include_gen_folder = Path (target_dir ) / "include"
1577
1576
for file_godot_cpp_name , file_godot_names in file_types_mapping .items ():
1578
- header_filename = file_godot_cpp_name .replace ("godot_cpp" , "godot_compat" )
1579
- header_filepath = include_gen_folder / header_filename
1577
+ header_filepath = file_godot_cpp_name .replace ("godot_cpp" , "godot_compat" )
1578
+ if "gen/include" not in header_filepath :
1579
+ header_filepath = header_filepath .replace ("include/" , "gen/include/" )
1580
1580
Path (os .path .dirname (header_filepath )).mkdir (parents = True , exist_ok = True )
1581
1581
result = []
1582
- snake_header_name = camel_to_snake (header_filename )
1582
+ snake_header_name = camel_to_snake (header_filepath )
1583
1583
add_header (f"{ snake_header_name } .hpp" , result )
1584
1584
1585
1585
header_guard = f"GODOT_COMPAT_{ os .path .splitext (os .path .basename (header_filepath ).upper ())[0 ]} _HPP"
@@ -1594,7 +1594,7 @@ def generate_compat_includes(godot_repo: Path, target_dir: Path):
1594
1594
result .append (f"#endif" )
1595
1595
result .append ("" )
1596
1596
result .append (f"#endif // ! { header_guard } " )
1597
- with header_filepath .open ("w+" , encoding = "utf-8" ) as header_file :
1597
+ with Path ( header_filepath ) .open ("w+" , encoding = "utf-8" ) as header_file :
1598
1598
header_file .write ("\n " .join (result ))
1599
1599
1600
1600
0 commit comments