(data)
| 238 | add(stem.toLowerCase()); |
| 239 | // also try compress? not needed for lookup from decoded |
| 240 | } |
| 241 | |
| 242 | // short hash names like 18858a142 |
| 243 | if (/^[0-9a-f]{8,12}$/i.test(stem)) { |
| 244 | add(stem); |
| 245 | } |
| 246 | }, |
| 247 | |
| 248 | async processSubpackages() { |
| 249 | const settings = this.getCCSettings(); |
| 250 | if (!this.isEmptyObject(settings.subpackages)) { |
| 251 | const subpackagesPath = path.dirname(global.paths.res) + '/subpackages'; |
| 252 | |
| 253 | if (fs.existsSync(subpackagesPath)) { |
| 254 | await this.readFiles(subpackagesPath, false); |
| 255 | logger.debug(`处理子包: ${subpackagesPath}`); |
| 256 | } else { |
| 257 | logger.warn(`子包路径不存在: ${subpackagesPath}`); |
| 258 | } |
| 259 | } |
| 260 | }, |
| 261 | |
| 262 | /** |
| 263 | * 处理 JSON 文件:并行读盘,串行拆包/分发 |
| 264 | */ |
| 265 | async processJsonFiles() { |
| 266 | const jsonFiles = this.fileList.filter((p) => path.extname(p) === '.json'); |
| 267 | const concurrency = getMaxParallel(); |
| 268 | |
| 269 | const parsed = await mapPool(jsonFiles, concurrency, async (currPath) => { |
| 270 | try { |
| 271 | const currFile = await fsp.readFile(currPath, 'utf-8'); |
| 272 | const key = this.getKeyFromPath(currPath); |
| 273 | return { key, data: JSON.parse(currFile), path: currPath }; |
| 274 | } catch (err) { |
| 275 | logger.error(`读取 JSON 文件 ${currPath} 时出错:`, err); |
nothing calls this directly
no outgoing calls
no test coverage detected