* 递归读取目录下所有文件 * @param {string} filePath 文件路径 * @param {boolean} first 是否为首次调用 * @returns {Promise }
(filePath, first)
| 124 | |
| 125 | /** |
| 126 | * 从 settings 构建 uuid / packed / rawAssets 索引 |
| 127 | */ |
| 128 | buildSettingsIndex() { |
| 129 | const settings = this.getCCSettings(); |
| 130 | this._uuidList = Array.isArray(settings.uuids) ? settings.uuids : []; |
| 131 | this._packedMap = settings.packedAssets && typeof settings.packedAssets === 'object' |
| 132 | ? settings.packedAssets |
| 133 | : {}; |
| 134 | |
| 135 | const assetTypes = Array.isArray(settings.assetTypes) ? settings.assetTypes : []; |
| 136 | const rawAssets = settings.rawAssets || {}; |
| 137 | |
| 138 | for (const group of Object.keys(rawAssets)) { |
| 139 | const table = rawAssets[group] || {}; |
| 140 | for (const key of Object.keys(table)) { |
| 141 | const entry = table[key]; |
| 142 | if (!Array.isArray(entry) || entry.length < 2) continue; |
| 143 | const relPath = entry[0]; |
| 144 | const typeIndex = entry[1]; |
| 145 | const typeName = assetTypes[typeIndex] || null; |
| 146 | const info = { path: relPath, type: typeIndex, typeName, group }; |
| 147 | |
| 148 | // key may be uuids[] index or compact uuid |
| 149 | const compact = this.expandUuidRef(key); |
| 150 | const decoded = this.decodeMaybe(compact); |
| 151 | this._rawAssetMap.set(String(key), info); |
| 152 | if (compact != null) this._rawAssetMap.set(String(compact), info); |
| 153 | if (decoded) this._rawAssetMap.set(decoded, info); |
nothing calls this directly
no outgoing calls
no test coverage detected