fixed another stupid path bug

fixed more module loading bugs
This commit is contained in:
David Anderson 2006-06-07 19:09:48 +00:00
parent 68e1937a5c
commit 5463a84c12
2 changed files with 8 additions and 3 deletions

View File

@ -157,33 +157,38 @@ void ParseAndOrAdd(CStack<String *> & files, const char *name)
{ {
if (strncmp(name, "plugins-", 8) == 0) if (strncmp(name, "plugins-", 8) == 0)
{ {
#if !defined WIN32
size_t len = strlen(name); size_t len = strlen(name);
if (strcmp(&name[len-4], ".ini") == 0) if (strcmp(&name[len-4], ".ini") == 0)
{ {
#endif
String *pString = new String(name); String *pString = new String(name);
files.push(pString); files.push(pString);
#if !defined WIN32
} }
#endif
} }
} }
void BuildPluginFileList(CStack<String *> & files) void BuildPluginFileList(CStack<String *> & files)
{ {
char path[255]; char path[255];
build_pathname_r(path, sizeof(path)-1, "%s/", get_localinfo("amxx_configsdir", "addons/amxmodx/configs"));
#if defined WIN32 #if defined WIN32
build_pathname_r(path, sizeof(path)-1, "%s/*.ini", get_localinfo("amxx_configsdir", "addons/amxmodx/configs"));
_finddata_t fd; _finddata_t fd;
intptr_t handle = _findfirst(path, &fd); intptr_t handle = _findfirst(path, &fd);
if (handle < 0) if (handle < 0)
return; return;
while (_findnext(handle, &fd) < 0) while (!_findnext(handle, &fd))
{ {
ParseAndOrAdd(files, fd.name); ParseAndOrAdd(files, fd.name);
} }
_findclose(handle); _findclose(handle);
#elif defined __linux__ #elif defined __linux__
build_pathname_r(path, sizeof(path)-1, "%s/", get_localinfo("amxx_configsdir", "addons/amxmodx/configs"));
struct dirent *ep; struct dirent *ep;
DIR *dp; DIR *dp;

View File

@ -480,7 +480,7 @@ int CheckModules(AMX *amx, char error[128])
{ {
if (expect == LibType_Library) if (expect == LibType_Library)
{ {
if (!LoadModule(buffer, PT_ANYTIME)) if (!LoadModule(buffer, PT_ANYTIME, true, true))
{ {
if (pHandler->HandleModule(buffer, (expect == LibType_Class))) if (pHandler->HandleModule(buffer, (expect == LibType_Class)))
found = true; found = true;