From 130f274f8679ab46209453c8b1144b94b19c784e Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Wed, 24 Mar 2004 18:59:37 +0000 Subject: [PATCH] more localinfos --- amxmodx/CPlugin.cpp | 2 +- amxmodx/amxmodx.h | 3 ++- amxmodx/meta_api.cpp | 5 +++-- amxmodx/modules.cpp | 10 +++++----- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/amxmodx/CPlugin.cpp b/amxmodx/CPlugin.cpp index 953e6d8d..afc662fe 100755 --- a/amxmodx/CPlugin.cpp +++ b/amxmodx/CPlugin.cpp @@ -62,7 +62,7 @@ int CPluginMngr::loadPluginsFromFile( const char* filename ) // Find now folder char pluginName[256], line[256], error[256]; - const char pluginsDir[] = "addons/amxx/plugins"; // hardcoded; :TODO: make it localinfo + const char *pluginsDir = get_localinfo("amxx_pluginsdir", "addons/amxx/plugins"); while ( fp.getline(line , 255 ) ) diff --git a/amxmodx/amxmodx.h b/amxmodx/amxmodx.h index dfeea693..06b81e20 100755 --- a/amxmodx/amxmodx.h +++ b/amxmodx/amxmodx.h @@ -240,7 +240,8 @@ void print_srvconsole( char *fmt, ... ); void report_error( int code, char* fmt, ... ); void* alloc_amxmemory(void**, int size); void free_amxmemory(void **ptr); - +// get_localinfo +const char* get_localinfo( const char* name , const char* def ); #endif // AMXMODX_H diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index 8db85d30..c6495356 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -231,9 +231,10 @@ int Spawn( edict_t *pent ) { g_commands.registerPrefix( "sm_" ); g_commands.registerPrefix( "cm_" ); - // make sure basedir is set + // make sure localinfos are set get_localinfo("amxx_basedir", "addons/amxx"); - + get_localinfo("amxx_pluginsdir", "addons/amxx/plugins"); + get_localinfo("amxx_modulesdir", "addons/amxx/modules"); // ###### Load modules loadModules(get_localinfo("amxx_modules", "addons/amxx/modules.ini")); attachModules(); diff --git a/amxmodx/modules.cpp b/amxmodx/modules.cpp index ab7170e2..cf8a8199 100755 --- a/amxmodx/modules.cpp +++ b/amxmodx/modules.cpp @@ -362,7 +362,7 @@ int loadModules(const char* filename) if (!isalnum(*moduleName) || !validFile(moduleName) ) continue; - char* pathname = build_pathname("addons/amxx/modules/%s", line); + char* pathname = build_pathname("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxx/modules"), line); CList::iterator a = g_modules.find( pathname ); @@ -476,8 +476,8 @@ void dettachMetaModModules( const char* filename ) if (!isalnum(*moduleName) || !validFile(moduleName) ) continue; - char* pathname = build_pathname_addons("addons/amxx/modules/%s", line); - char* mmpathname = build_pathname_addons("addons/amxx/modules/%s", line); + char* pathname = build_pathname("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxx/modules"), line); + char* mmpathname = build_pathname_addons("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxx/modules"), line); module = DLLOAD( pathname ); // link dll @@ -520,8 +520,8 @@ void attachMetaModModules( const char* filename ) if (!isalnum(*moduleName) || !validFile(moduleName) ) continue; - char* pathname = build_pathname("addons/amxx/modules/%s", line); - char* mmpathname = build_pathname_addons("addons/amxx/modules/%s", line); + char* pathname = build_pathname("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxx/modules"), line); + char* mmpathname = build_pathname_addons("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxx/modules"), line); module = DLLOAD( pathname ); // link dll if ( module )