Skip to content

fix(tvos): copy project resource dirs into the .app bundle#4787

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
proggeramlug:fix/tvos-bundle-resources
Jun 8, 2026
Merged

fix(tvos): copy project resource dirs into the .app bundle#4787
proggeramlug merged 1 commit into
PerryTS:mainfrom
proggeramlug:fix/tvos-bundle-resources

Conversation

@proggeramlug
Copy link
Copy Markdown
Contributor

Summary

bundle_for_tvos never copied the project's resource directories into the .app, so the assets/ directory (levels, sprite sheets, sounds) was absent from every tvOS bundle. The iOS, watchOS, and visionOS bundlers all call copy_bundle_resource_dirs; the tvOS path skipped it, with a comment claiming "tvOS apps consume assets via the metallib / embedded JS bundle."

That assumption is wrong for any app that reads asset files at runtime: bloom_read_file / bloom_load_texture (and equivalents) resolve relative paths against [[NSBundle mainBundle] resourcePath]. With nothing copied, every asset read failed — a platformer compiled for --target tvos-simulator booted to its title screen (procedural drawing) but loaded an empty level, because assets/levels/*.txt and assets/sprites/*.png weren't in the bundle.

Change

Add the same resource-copy block the other Apple targets use, right after stage_native_library_artifacts:

if let Some(src_dir) = input.canonicalize().ok().and_then(|p| p.parent().map(|d| d.to_path_buf())) {
    let project_root = find_project_root_for_resources(&src_dir, true);
    copy_bundle_resource_dirs(&project_root, &app_dir);
}

Validation

Rebuilt the perry binary and recompiled a Bloom Engine game for tvos-simulator. A clean build (rm -rf *.app first) now bundles assets/levels/, assets/sprites/, assets/sounds/, etc. automatically, and the game loads and renders a real level on the Apple TV simulator (previously the level was empty).

bundle_for_tvos never called copy_bundle_resource_dirs, unlike the iOS,
watchOS, and visionOS bundlers. The dropped comment claimed tvOS apps
consume assets via the metallib / embedded JS bundle, but games read asset
files (levels, sprite sheets, sounds) at runtime through bloom_read_file /
bloom_load_texture, which resolve relative paths against the bundle's
[[NSBundle mainBundle] resourcePath]. With no resource copy, the project
assets/ directory was absent from the bundle and every asset read failed.

Copy the project resource directories after staging native artifacts, the
same as the other Apple targets.
@proggeramlug proggeramlug merged commit 3e793ad into PerryTS:main Jun 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant