MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / TryAutoload

Method TryAutoload

core/logic/ExtensionSys.cpp:498–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496}
497
498void 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
542IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOnMissing)
543{

Callers 1

DoGlobalPluginLoadsMethod · 0.80

Calls 6

BuildPathMethod · 0.80
OpenDirectoryMethod · 0.80
MoreFilesMethod · 0.80
IsEntryDirectoryMethod · 0.80
NextEntryMethod · 0.80
GetEntryNameMethod · 0.80

Tested by

no test coverage detected