failsafe autoloading of libraries for 1.71- plugins
This commit is contained in:
parent
79f86bfabd
commit
6995b182c1
|
@ -522,6 +522,20 @@ void CPluginMngr::CacheAndLoadModules(const char *plugin)
|
||||||
|
|
||||||
int num;
|
int num;
|
||||||
char name[sNAMEMAX+1];
|
char name[sNAMEMAX+1];
|
||||||
|
|
||||||
|
num = amx_GetLibraries(&amx);
|
||||||
|
for (int i=0; i<num; i++)
|
||||||
|
{
|
||||||
|
amx_GetLibrary(&amx, i, name, sNAMEMAX);
|
||||||
|
if (stricmp(name, "Float")==0)
|
||||||
|
continue;
|
||||||
|
//awful backwards compat hack
|
||||||
|
if (stricmp(name, "socket")==0)
|
||||||
|
strcpy(name, "sockets");
|
||||||
|
//we don't want to report failed modules here...
|
||||||
|
LoadModule(name, PT_ANYTIME, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
cell tag_id;
|
cell tag_id;
|
||||||
amx_NumTags(&amx, &num);
|
amx_NumTags(&amx, &num);
|
||||||
|
|
||||||
|
|
|
@ -868,7 +868,7 @@ bool ConvertModuleName(const char *pathString, String &path)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LoadModule(const char *shortname, PLUG_LOADTIME now, bool simplify)
|
bool LoadModule(const char *shortname, PLUG_LOADTIME now, bool simplify, bool noFileBail)
|
||||||
{
|
{
|
||||||
char pathString[512];
|
char pathString[512];
|
||||||
String path;
|
String path;
|
||||||
|
@ -888,6 +888,14 @@ bool LoadModule(const char *shortname, PLUG_LOADTIME now, bool simplify)
|
||||||
path.assign(pathString);
|
path.assign(pathString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (noFileBail)
|
||||||
|
{
|
||||||
|
FILE *fp = fopen(path.c_str(), "rb");
|
||||||
|
if (!fp)
|
||||||
|
return false;
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
CList<CModule, const char *>::iterator a = g_modules.find(path.c_str());
|
CList<CModule, const char *>::iterator a = g_modules.find(path.c_str());
|
||||||
|
|
||||||
if (a)
|
if (a)
|
||||||
|
|
|
@ -72,7 +72,7 @@ typedef enum
|
||||||
} PlayerProp;
|
} PlayerProp;
|
||||||
|
|
||||||
int CheckModules(AMX *amx, char error[128]);
|
int CheckModules(AMX *amx, char error[128]);
|
||||||
bool LoadModule(const char *shortname, PLUG_LOADTIME now, bool simplify=true);
|
bool LoadModule(const char *shortname, PLUG_LOADTIME now, bool simplify=true, bool noFileBail=false);
|
||||||
const char *StrCaseStr(const char *as, const char *bs);
|
const char *StrCaseStr(const char *as, const char *bs);
|
||||||
|
|
||||||
class Debugger;
|
class Debugger;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user