Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(native): keep the iOS Content placeholder in the tree

esenginede0ea73cd3af
diff --git a/build-tools/tasks/native.js b/build-tools/tasks/native.js
index f5201a4df..44e628de3 100644
--- a/build-tools/tasks/native.js
+++ b/build-tools/tasks/native.js
@@ -191,9 +191,14 @@ async function stageIosContent(rootDir, contentDir) {
const from = path.isAbsolute(contentDir) ? contentDir : path.join(rootDir, contentDir);
if (!existsSync(from)) throw new Error(`--content dir not found: ${from}`);
const to = path.join(rootDir, 'native', 'ios', 'Content');
+ const keep = path.join(to, '.gitkeep');
+ const keepText = existsSync(keep) ? readFileSync(keep, 'utf8') : null;
await rm(to, { recursive: true, force: true });
await mkdir(to, { recursive: true });
await cp(from, to, { recursive: true });
+ // The placeholder is committed so a fresh clone has the directory xcodegen's
+ // folder reference needs; staging content must not delete it.
+ if (keepText !== null) writeFileSync(keep, keepText);
logger.success(`iOS content: native/ios/Content ← ${path.relative(rootDir, from)}`);
}
diff --git a/native/ios/Content/.gitkeep b/native/ios/Content/.gitkeep
new file mode 100644
index 000000000..06eda5a47
--- /dev/null
+++ b/native/ios/Content/.gitkeep
@@ -0,0 +1,4 @@
+Exported project content lands here (cli native --target ios --content <dir>) and
+ships as a folder reference, so its subdirectories survive into the app bundle.
+Committed empty: xcodegen needs the directory to exist, and the built-in demo
+reads from the bundle root instead.