预览扫描

This commit is contained in:
tianmo committed 2026-09-17 18:47:17 +08:00
1 parent 2a5fe0ce1f
commit 2cb70c49d4
6 files changed
+86 -10

No files matched your search

@@ -507,10 +507,15 @@ function discoverAssets(filePath, options) {
const selected = path.basename(filePath);
const selectedStem = normalizeStem(selected);
// 先扫码“选中 item 文件夹 + 同级所有 .info”(精确、不跨批次)。
const roots = getSearchRoots(filePath);
// 若同级范围无法凑齐骨架+图集(常见于 Eagle 导入瞬间,同伴落在别的 .info),
// 则扩展搜索到整个库的 images/ 目录(全库兜底,靠“同家族 + 同文件夹 + 最近 btime”配对)。
buildRootsWithLibraryRoot(filePath, roots);
let roots;
if (Array.isArray(options.searchRoots) && options.searchRoots.length) {
roots = [...new Set(options.searchRoots.map((root) => path.resolve(root)))];
} else {
roots = getSearchRoots(filePath);
// 兼容旧的非查询调用:扩展到整个库。查看器会传入 Eagle API
// 明确列举的候选 item 目录,避免每次预览扫描整库。
buildRootsWithLibraryRoot(filePath, roots);
}
// 导入时 Eagle 会先创建各个 .info,再异步写 folders。严格模式必须把尚未写入
// folders 的同批资源也纳入候选,之后用 metadata.json 的 birthtime 精确配对。