* 解析设置文件 * @param {Buffer} settings 设置文件内容
(settings)
| 360 | if (isBundleRoot(root)) { |
| 361 | logger.info('检测到 2.4.x/3.x bundle 结构(含 MD5 config),使用 bundle 解析管线'); |
| 362 | return { version: '3.x', sourcePath: root }; |
| 363 | } |
| 364 | } |
| 365 | for (const root of uniqueCandidateRoots) { |
| 366 | const hit = tryClassicLayout(root, '2.4.x'); |
| 367 | if (hit) { |
| 368 | logger.info('使用用户指定的Cocos Creator 2.4.x项目结构'); |
| 369 | return hit; |
| 370 | } |
| 371 | } |
| 372 | logger.warn('用户指定2.4.x版本,但未找到对应文件结构,尝试自动检测...'); |
| 373 | } else if (versionHint === '2.3.x') { |
| 374 | for (const root of uniqueCandidateRoots) { |
| 375 | const hit = tryClassicLayout(root, '2.3.x'); |
| 376 | if (hit) { |
| 377 | logger.info('使用用户指定的Cocos Creator 2.3.x项目结构'); |
| 378 | return hit; |
| 379 | } |
| 380 | } |
| 381 | logger.warn('用户指定2.3.x版本,但未找到对应文件结构,尝试自动检测...'); |
| 382 | } |
| 383 | |
| 384 | // Auto-detect bundle style first (3.x and 2.4 MD5 / bundle) |
| 385 | for (const root of uniqueCandidateRoots) { |
| 386 | if (isBundleRoot(root)) { |
| 387 | logger.info('自动检测到Cocos Creator bundle 项目结构 (3.x / 2.4.x MD5)'); |
| 388 | return { version: '3.x', sourcePath: root }; |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | // 2.3.x (更精确) |
| 393 | for (const root of uniqueCandidateRoots) { |
| 394 | const hit = tryClassicLayout(root, '2.3.x'); |
| 395 | if (hit) { |
| 396 | logger.info('自动检测到Cocos Creator 2.3.x或更早版本项目结构'); |
| 397 | return hit; |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | // classic 2.4.x |
| 402 | for (const root of uniqueCandidateRoots) { |
| 403 | const hit = tryClassicLayout(root, '2.4.x'); |
| 404 | if (hit) { |