INNER CODE UNIT · Python

default_api_file

JetBrains/godot-support · godot-rd/godot_cpp_gen_main.py:44

def default_api_file(version: str) -> Path:
    return VENDORED_GODOT_CPP_DIR / "gdextension" / f"extension_api-{version.replace('.', '-')}.json"


def render_generated_files_bzl(version: str, api_file: Path) -> str:
    if not api_file.is_file():
        raise FileNotFoundError(f"Godot extension API file does not exist: {api_file}")

    generated_files = get_file_list(
        api_filepath=str(api_file),
        output_dir=".",
        headers=True,
        sources=True,
    )
    headers = sorted(path for path in generated_files if path.endswith((".h", ".hpp", ".inc")))
    sources = sorted(path for path in generated_files if path.endswith(".cpp"))
    if len(headers) + len(sources) != len(generated_files):
        raise ValueError("The godot-cpp generator returned a file with an unsupported extension")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…