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

Method LoadExtension

core/logic/ExtensionSys.cpp:634–672  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

632}
633
634IExtension *CExtensionManager::LoadExtension(const char *file, char *error, size_t maxlength)
635{
636 if (strstr(file, "..") != NULL)
637 {
638 ke::SafeStrcpy(error, maxlength, "Cannot load extensions outside the \"extensions\" folder.");
639 return NULL;
640 }
641
642 /* Remove platform extension if it's there. Compat hack. */
643 const char *ext = libsys->GetFileExtension(file);
644 if (ext && strcmp(ext, PLATFORM_LIB_EXT) == 0)
645 {
646 char path2[PLATFORM_MAX_PATH];
647 ke::SafeStrcpy(path2, sizeof(path2), file);
648 path2[strlen(file) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
649 return LoadExtension(path2, error, maxlength);
650 }
651
652 IExtension *pAlready;
653 if ((pAlready=FindExtensionByFile(file)) != NULL)
654 {
655 return pAlready;
656 }
657
658 CExtension *pExt = new CLocalExtension(file);
659
660 if (!pExt->Load(error, maxlength) || !pExt->IsLoaded())
661 {
662 pExt->Unload();
663 delete pExt;
664 return NULL;
665 }
666
667 /* :TODO: do QueryRunning check if the map is loaded */
668
669 m_Libs.push_back(pExt);
670
671 return pExt;
672}
673
674void CExtensionManager::BindDependency(IExtension *pRequester, IfaceInfo *pInfo)
675{

Callers

nothing calls this directly

Calls 5

GetFileExtensionMethod · 0.80
IsLoadedMethod · 0.80
push_backMethod · 0.80
LoadMethod · 0.45
UnloadMethod · 0.45

Tested by

no test coverage detected