@@ -423,7 +423,7 @@ def generate_bindings(api_filepath, use_template_get_node, bits="64", precision=
423423 generate_engine_classes_bindings (api , target_dir , use_template_get_node )
424424 generate_utility_functions (api , target_dir )
425425 if godot_repo != "" :
426- generate_compat_includes (godot_repo , target_dir )
426+ generate_compat_includes (godot_repo , output_dir , target_dir )
427427
428428
429429CLASS_ALIASES = {
@@ -1567,19 +1567,19 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node):
15671567 header_file .write ("\n " .join (result ))
15681568
15691569
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 )
15721572 file_types_mapping_godot = map_header_files (godot_repo )
15731573 # Match the headers
15741574 file_types_mapping = match_headers (file_types_mapping_godot_cpp_gen , file_types_mapping_godot )
15751575
1576- include_gen_folder = Path (target_dir ) / "include"
15771576 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/" )
15801580 Path (os .path .dirname (header_filepath )).mkdir (parents = True , exist_ok = True )
15811581 result = []
1582- snake_header_name = camel_to_snake (header_filename )
1582+ snake_header_name = camel_to_snake (header_filepath )
15831583 add_header (f"{ snake_header_name } .hpp" , result )
15841584
15851585 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):
15941594 result .append (f"#endif" )
15951595 result .append ("" )
15961596 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 :
15981598 header_file .write ("\n " .join (result ))
15991599
16001600
0 commit comments