diff options
| author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-30 06:05:56 +0300 | 
|---|---|---|
| committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-30 06:05:56 +0300 | 
| commit | 7c8423594d9601ce6bf78838a36d896ab94e728e (patch) | |
| tree | d596de8e96d0d0d4921a6d94b6f56a72ef39336c /core | |
| parent | 70d22ef07b945b799f6a8d39cbfbb1b6624f61a9 (diff) | |
	modified:   core/modules.cpp
	modified:   core/utf8.cpp
Diffstat (limited to 'core')
| -rw-r--r-- | core/modules.cpp | 29 | ||||
| -rw-r--r-- | core/utf8.cpp | 1 | 
2 files changed, 18 insertions, 12 deletions
diff --git a/core/modules.cpp b/core/modules.cpp index 3708655..a8b6644 100644 --- a/core/modules.cpp +++ b/core/modules.cpp @@ -8,6 +8,7 @@ void load_modules()  {  	std::string path = boost::filesystem::initial_path().directory_string(); //need some workaround for windows than called indirectly  	path.append("/plugins"); +	logger.log(LM_DEBUG, "Plugin directory is %s \n", path.c_str());  	logger.log(LM_DEBUG, "Loading plugins...\n");  	boost::filesystem::path pth(path);  	if(!boost::filesystem::is_directory(pth)) @@ -17,11 +18,13 @@ void load_modules()  	{  		if(boost::filesystem::is_directory(*i)) //we not look in subdirectories  		{ +			logger.log(LM_DEBUG, "found subdirectory under plugins directory, skipping.\n");  			++i;  			continue;  		}  		if(!boost::filesystem::status_known((*i).status())) //worng data  		{ +			logger.log(LM_DEBUG, "found invalid filesystem object, skipping.\n");  			++i;  			continue;  		} @@ -32,13 +35,25 @@ void load_modules()  		if(dll->open(pth.string().c_str()) != -1)  		{  			if((funcs->Load = (load)dll->symbol("load")) == NULL) +			{  				is_plugin = false; +				logger.log(LM_DEBUG, "\'load\' not found in library, this is not plugin.\n"); +			}  			if((funcs->OnModulesLoaded = (on_modules_loaded)dll->symbol("on_modules_loaded")) == NULL) +			{  				is_plugin = false; +				logger.log(LM_DEBUG, "\'on_modules_loaded\' not found in library, this is not plugin.\n"); +			}  			if((funcs->Unload = (unload)dll->symbol("unload")) == NULL) +			{  				is_plugin = false; +				logger.log(LM_DEBUG, "\'unload\' not found in library, this is not plugin.\n"); +			}  			if((funcs->SetPluginInfo = (set_plugin_info)dll->symbol("set_plugin_info")) == NULL) +			{  				is_plugin = false; +				logger.log(LM_DEBUG, "\'set_plugin_info\' not found in library, this is not plugin.\n"); +			}  		}  		if(!is_plugin)  		{ @@ -61,21 +76,11 @@ void run_plugins()  			boost::thread *thr;  			thr = new boost::thread(boost::bind((*i)->get_exported_functions()->Load, &pluglink));  			if(!thr->timed_join(boost::posix_time::seconds(10))) -			{ -				std::string msg = "Thread execution timeout, plugin "; -				msg += toUTF8((*i)->get_plugininfo()->name); -				msg += " basic initialisation failed.\n"; -				logger.log(LM_DEBUG, msg.c_str()); -			} +				logger.log(LM_DEBUG, "Thread execution timeout, plugin %s basic initialisation failed.\n", toUTF8((*i)->get_plugininfo()->name).c_str());  			delete thr;  			thr = new boost::thread(boost::bind((*i)->get_exported_functions()->OnModulesLoaded));  			if(!thr->timed_join(boost::posix_time::seconds(15))) -			{ -				std::string msg = "Thread execution timeout, plugin "; -				msg += toUTF8((*i)->get_plugininfo()->name); -				msg += " main initialisation failed.\n"; -				logger.log(LM_DEBUG, msg.c_str()); -			} +				logger.log(LM_DEBUG, "Thread execution timeout, plugin %s main initialisation failed.\n", toUTF8((*i)->get_plugininfo()->name).c_str());  			delete thr;  		}  	} diff --git a/core/utf8.cpp b/core/utf8.cpp index 25ed595..197684a 100644 --- a/core/utf8.cpp +++ b/core/utf8.cpp @@ -23,3 +23,4 @@ std::wstring toUTF16(std::string str) //convert as much as possible  	utf8::utf8to16(tmpstr.begin(), tmpstr.end(), back_inserter(ustr));  	return ustr;  } +  | 
