| 496 | } |
| 497 | |
| 498 | void CExtensionManager::TryAutoload() |
| 499 | { |
| 500 | char path[PLATFORM_MAX_PATH]; |
| 501 | |
| 502 | g_pSM->BuildPath(Path_SM, path, sizeof(path), "extensions"); |
| 503 | |
| 504 | std::unique_ptr<IDirectory> pDir(libsys->OpenDirectory(path)); |
| 505 | if (!pDir) |
| 506 | return; |
| 507 | |
| 508 | const char *lfile; |
| 509 | size_t len; |
| 510 | while (pDir->MoreFiles()) |
| 511 | { |
| 512 | if (pDir->IsEntryDirectory()) |
| 513 | { |
| 514 | pDir->NextEntry(); |
| 515 | continue; |
| 516 | } |
| 517 | |
| 518 | lfile = pDir->GetEntryName(); |
| 519 | len = strlen(lfile); |
| 520 | if (len <= 9) /* size of ".autoload" */ |
| 521 | { |
| 522 | pDir->NextEntry(); |
| 523 | continue; |
| 524 | } |
| 525 | |
| 526 | if (strcmp(&lfile[len - 9], ".autoload") != 0) |
| 527 | { |
| 528 | pDir->NextEntry(); |
| 529 | continue; |
| 530 | } |
| 531 | |
| 532 | char file[PLATFORM_MAX_PATH]; |
| 533 | len = ke::SafeStrcpy(file, sizeof(file), lfile); |
| 534 | strcpy(&file[len - 9], ".ext"); |
| 535 | |
| 536 | LoadAutoExtension(file); |
| 537 | |
| 538 | pDir->NextEntry(); |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOnMissing) |
| 543 | { |
no test coverage detected