int C_getpluginpath(lua_State* L) { const char* plugin_path = GetPluginPath(); if (plugin_path) { lua_pushstring(L, plugin_path); } else { lua_pushnil(L); } return 1; };
inline BOOL MFramework::Init() { /* Get all the modules list and init */ std::string dir; //dir = Path::current(); std::string pluginPath = GetPluginPath() + "/mplugins/"; dir = pluginPath; try { DirectoryIterator it(dir); DirectoryIterator end; while (it != end) { /* loop for each dir */ if (it->isDirectory() == true) { astring strName = it->path(); try { DirectoryIterator it2(it->path()); DirectoryIterator end2; while (it2 != end2) { astring strName2 = it2->path(); if (it2->path().find("mplugin") != std::string::npos) { /* Find a plugin and call mmodule to add */ astring strPluginName = it2->path(); MiningModule * pModule = new MiningModule(strPluginName, m_pFactory); if (pModule && pModule->Valid() == TRUE) { pModule->Init(); m_MModules[strPluginName] = pModule; } } ++it2; } } catch (Poco::Exception& exc) { continue; } } ++it; } } catch (Poco::Exception& exc) { std::cerr << exc.displayText() << std::endl; VDC_DEBUG( "Plugin init error \n"); return FALSE; } return TRUE; }