extends SceneTree ## Exports a resource pack and checks that the files the game reads at runtime ## via raw FileAccess (not as Godot resources) are actually inside it. ## ## `export_filter="all_resources"` packs scenes/scripts/imported assets but ## NOT arbitrary files like assets/avatars/catalog.json -- which the avatar ## system opens with FileAccess.open(). Missing it means the game runs fine ## from source but the exported .exe shows a bare capsule instead of an ## avatar. This is the guard for that class of bug. ## ## Run: godot --headless --path . --script res://scripts/verify_export_contents.gd const PACK_PATH := "res://.export_check.pck" ## Files that MUST be in the pack for the game to work, that aren't Godot ## resources (so they only get packed via export_presets include_filter). const REQUIRED := [ "res://assets/avatars/catalog.json", "res://assets/editor/object_catalog.json", ] ## A resource we know should be there, as a sanity check that the pack loaded. const SANITY := "res://scenes/game.tscn" func _initialize() -> void: var abs_pack := ProjectSettings.globalize_path(PACK_PATH) var export := OS.execute(_godot_bin(), [ "--headless", "--path", ProjectSettings.globalize_path("res://"), "--export-pack", "Linux", abs_pack, ], [], true) if not FileAccess.file_exists(PACK_PATH): _fail("export-pack produced no file:\n%s" % export) if not ProjectSettings.load_resource_pack(PACK_PATH, false): _fail("could not load the exported pack back") if not FileAccess.file_exists(SANITY): _fail("pack sanity check failed -- %s not found (pack may not have loaded)" % SANITY) var missing := [] for f in REQUIRED: if not FileAccess.file_exists(f): missing.append(f) DirAccess.remove_absolute(abs_pack) if missing.is_empty(): print("=== SMOKE RESULT: PASS === (required non-resource files are in the export)") quit(0) else: print("=== SMOKE RESULT: FAIL ===") for f in missing: printerr(" MISSING from export: ", f, " -- add its glob to export_presets.cfg include_filter") quit(1) func _godot_bin() -> String: return OS.get_executable_path() func _fail(msg: String) -> void: printerr(msg) print("=== SMOKE RESULT: FAIL ===") quit(1)