Changed how plugins.ini is read

This commit is contained in:
David Anderson 2004-09-17 00:46:33 +00:00
parent b7c0c47c05
commit f9a57a83a0

View File

@ -50,7 +50,7 @@ void CPluginMngr::unloadPlugin( CPlugin** a ) {
int CPluginMngr::loadPluginsFromFile( const char* filename ) int CPluginMngr::loadPluginsFromFile( const char* filename )
{ {
File fp( build_pathname("%s",filename) , "r" ); FILE *fp = fopen(build_pathname("%s",filename) , "rt");
if ( !fp ) if ( !fp )
{ {
@ -59,17 +59,20 @@ int CPluginMngr::loadPluginsFromFile( const char* filename )
} }
// Find now folder // Find now folder
char pluginName[256], line[256], error[256], debug[256]; char pluginName[256], error[256], debug[256];
int debugFlag = 0; int debugFlag = 0;
const char *pluginsDir = get_localinfo("amxx_pluginsdir", "addons/amxmodx/plugins"); const char *pluginsDir = get_localinfo("amxx_pluginsdir", "addons/amxmodx/plugins");
String line;
while ( fp.getline(line , 255 ) )
while ( !feof(fp) )
{ {
*pluginName = 0; *pluginName = 0;
*debug = 0; *debug = 0;
debugFlag = 0; debugFlag = 0;
sscanf(line,"%s %s",pluginName, debug); line.clear();
line._fread(fp);
sscanf(line.c_str(),"%s %s",pluginName, debug);
if (!isalnum(*pluginName)) continue; if (!isalnum(*pluginName)) continue;
if (isalnum(*debug) && strcmp(debug, "debug") == 0) if (isalnum(*debug) && strcmp(debug, "debug") == 0)
@ -88,6 +91,8 @@ int CPluginMngr::loadPluginsFromFile( const char* filename )
} }
} }
fclose(fp);
return pCounter; return pCounter;
} }