...
This commit is contained in:
@@ -78,13 +78,26 @@ bundle_main :: () -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Copy the linked binary into the bundle as `<exe_name>`. Flat
|
||||
// layout (binary + Info.plist at bundle root) matches the legacy
|
||||
// Zig path for every Apple target — the canonical macOS
|
||||
// `Contents/MacOS/` layout is a follow-up.
|
||||
// Apple .app layout: macOS goes through `Contents/{MacOS,Resources}`;
|
||||
// iOS / iOS-sim lay everything flat at the bundle root.
|
||||
is_mac := opts.is_macos();
|
||||
macos_dir := if is_mac then concat(bundle, "/Contents/MacOS") else bundle;
|
||||
plist_dir := if is_mac then concat(bundle, "/Contents") else bundle;
|
||||
asset_root := if is_mac then concat(bundle, "/Contents/Resources") else bundle;
|
||||
if is_mac {
|
||||
if !create_dir_all(str_to_cstr(macos_dir)) {
|
||||
out("error: bundle: cannot create Contents/MacOS\n");
|
||||
return false;
|
||||
}
|
||||
if !create_dir_all(str_to_cstr(asset_root)) {
|
||||
out("error: bundle: cannot create Contents/Resources\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
exe_name := basename(binary);
|
||||
binary_z := str_to_cstr(binary);
|
||||
exe_dest := concat(bundle, "/");
|
||||
exe_dest := concat(macos_dir, "/");
|
||||
exe_dest = concat(exe_dest, exe_name);
|
||||
exe_dest_z := str_to_cstr(exe_dest);
|
||||
if !copy_file(binary_z, exe_dest_z) {
|
||||
@@ -96,7 +109,7 @@ bundle_main :: () -> bool {
|
||||
// Write Info.plist. Per-target shape — iOS needs UIDeviceFamily +
|
||||
// UIApplicationSceneManifest + DTPlatformName, macOS doesn't.
|
||||
plist := build_info_plist(opts, exe_name, bid);
|
||||
plist_path := concat(bundle, "/Info.plist");
|
||||
plist_path := concat(plist_dir, "/Info.plist");
|
||||
plist_path_z := str_to_cstr(plist_path);
|
||||
if !write_file(plist_path_z, plist) {
|
||||
out("error: bundle: write Info.plist failed\n");
|
||||
@@ -113,15 +126,15 @@ bundle_main :: () -> bool {
|
||||
}
|
||||
|
||||
// Copy any user-registered asset directories into the bundle.
|
||||
// Apple .app puts them at `<bundle>/<dest>/`. Android (Week 7) will
|
||||
// zip them into the APK at the same relative path. Recursive copy
|
||||
// shells out to `cp -R` until fs.sx grows `list_dir`.
|
||||
// macOS: `<bundle>/Contents/Resources/<dest>/`. iOS: `<bundle>/<dest>/`.
|
||||
// Android (Week 7) will zip them into the APK at the same relative path.
|
||||
// Recursive copy shells out to `cp -R` until fs.sx grows `list_dir`.
|
||||
asset_count := opts.asset_dir_count();
|
||||
j : s64 = 0;
|
||||
while j < asset_count {
|
||||
src := opts.asset_dir_src_at(j);
|
||||
dest := opts.asset_dir_dest_at(j);
|
||||
if !copy_asset_dir(src, dest, bundle) {
|
||||
if !copy_asset_dir(src, dest, asset_root) {
|
||||
out("error: bundle: failed to copy asset dir '");
|
||||
out(src);
|
||||
out("'\n");
|
||||
|
||||
Reference in New Issue
Block a user