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(assets): the launcher cover is not an asset - skip root thumbnail.png in adoption

yhh41f7e3e75f8e
diff --git a/desktop/electron/assetDb.ts b/desktop/electron/assetDb.ts
index f51a98e75..f42abdf0f 100644
--- a/desktop/electron/assetDb.ts
+++ b/desktop/electron/assetDb.ts
@@ -104,6 +104,10 @@ async function adoptOrphans(root: string, rel = '', adopted: string[] = []): Pro
if (!isContentDir(e.name)) continue;
await adoptOrphans(root, relPath, adopted);
} else if (isContentFile(e.name)) {
+ // The project-root thumbnail.png is the editor-managed launcher cover
+ // (rewritten on every scene save), not an asset — adopting it would put
+ // a churning file in the registry.
+ if (relPath === 'thumbnail.png') continue;
if ((await adoptOrphan(path.join(abs, e.name))) === 'adopted') adopted.push(relPath);
}
}
diff --git a/desktop/tests/asset-db.test.ts b/desktop/tests/asset-db.test.ts
index 12104b4f7..4081fdfc9 100644
--- a/desktop/tests/asset-db.test.ts
+++ b/desktop/tests/asset-db.test.ts
@@ -129,6 +129,15 @@ describe('scanAssetDatabase — orphan adoption', () => {
rmSync(abs);
});
+ it('the project-root thumbnail.png (editor-managed launcher cover) is never adopted', async () => {
+ const abs = path.join(root, 'thumbnail.png');
+ writeFileSync(abs, 'PNGDATA');
+ const res = await scanAssetDatabase(root, { write: false });
+ expect(res.adopted).toEqual([]);
+ expect(existsSync(`${abs}.meta`)).toBe(false);
+ rmSync(abs);
+ });
+
it('adopt: false is a pure read (cook path) — orphans stay untouched', async () => {
const abs = path.join(root, 'assets/pure.png');
writeFileSync(abs, 'PNGDATA');