From f9a57a83a0f658e8a1dca4a0ff2563b24c7bd89d Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 17 Sep 2004 00:46:33 +0000 Subject: [PATCH] Changed how plugins.ini is read --- amxmodx/CPlugin.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/amxmodx/CPlugin.cpp b/amxmodx/CPlugin.cpp index 78f98115..e55ad0ff 100755 --- a/amxmodx/CPlugin.cpp +++ b/amxmodx/CPlugin.cpp @@ -50,7 +50,7 @@ void CPluginMngr::unloadPlugin( CPlugin** a ) { int CPluginMngr::loadPluginsFromFile( const char* filename ) { - File fp( build_pathname("%s",filename) , "r" ); + FILE *fp = fopen(build_pathname("%s",filename) , "rt"); if ( !fp ) { @@ -59,17 +59,20 @@ int CPluginMngr::loadPluginsFromFile( const char* filename ) } // Find now folder - char pluginName[256], line[256], error[256], debug[256]; + char pluginName[256], error[256], debug[256]; int debugFlag = 0; const char *pluginsDir = get_localinfo("amxx_pluginsdir", "addons/amxmodx/plugins"); - - while ( fp.getline(line , 255 ) ) + String line; + + while ( !feof(fp) ) { *pluginName = 0; *debug = 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(*debug) && strcmp(debug, "debug") == 0) @@ -88,6 +91,8 @@ int CPluginMngr::loadPluginsFromFile( const char* filename ) } } + fclose(fp); + return pCounter; }