From 8a5ce94abf6b131a65797d7f2e72e08519e11bc2 Mon Sep 17 00:00:00 2001 From: Nate River <6752679+Nriver@users.noreply.github.com> Date: Wed, 7 Jan 2026 17:29:44 +0800 Subject: [PATCH] Update asset loading mechanism in workflow.dart Refactor asset loading to use AssetManifest API for better performance and clarity. --- lib/workflow.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/workflow.dart b/lib/workflow.dart index cf7b269..9fd72ec 100644 --- a/lib/workflow.dart +++ b/lib/workflow.dart @@ -611,7 +611,14 @@ chmod 1777 tmp Util.createDirFromString("${G.dataPath}/containers/0/.l2s"); //这个是容器rootfs,被split命令分成了xa*,放在assets里 //首次启动,就用这个,别让用户另选了 - for (String name in jsonDecode(await rootBundle.loadString('AssetManifest.json')).keys.where((String e) => e.startsWith("assets/xa")).map((String e) => e.split("/").last).toList()) { + //使用 AssetManifest API 获取 assets/xa* 文件列表 + final AssetManifest manifest = await AssetManifest.loadFromAssetBundle(rootBundle); + final List xaFiles = manifest + .listAssets() + .where((String key) => key.startsWith('assets/xa')) + .map((String key) => key.split('/').last) + .toList(); + for (String name in xaFiles) { await Util.copyAsset("assets/$name", "${G.dataPath}/$name"); } //-J