@@ -278,14 +278,19 @@ def generate_bindings(api_filepath, use_template_get_node, bits="64", precision=
278278 api = {}
279279 with open (api_filepath , encoding = "utf-8" ) as api_file :
280280 api = json .load (api_file )
281- _generate_bindings (api , use_template_get_node , bits , precision , output_dir )
281+ _generate_bindings (api , api_filepath , use_template_get_node , bits , precision , output_dir )
282282
283283
284- def _generate_bindings (api , use_template_get_node , bits = "64" , precision = "single" , output_dir = "." ):
284+ def _generate_bindings (api , api_filepath , use_template_get_node , bits = "64" , precision = "single" , output_dir = "." ):
285+ if "precision" in api ["header" ] and precision != api ["header" ]["precision" ]:
286+ raise Exception (
287+ f"Cannot do a precision={ precision } build using '{ api_filepath } ' which was generated by Godot built with precision={ api ['header' ]['precision' ]} "
288+ )
289+
285290 target_dir = Path (output_dir ) / "gen"
286291
287292 shutil .rmtree (target_dir , ignore_errors = True )
288- target_dir .mkdir (parents = True )
293+ target_dir .mkdir (parents = True , exist_ok = True )
289294
290295 real_t = "double" if precision == "double" else "float"
291296 print ("Built-in type config: " + real_t + "_" + bits )
0 commit comments