| 77 | } |
| 78 | |
| 79 | void RegistrationContext::loadPlugin(std::string const &pluginName) { |
| 80 | const std::string pluginPathName = pluginhost::findPlugin(pluginName); |
| 81 | if (pluginPathName.empty()) { |
| 82 | throw std::runtime_error("Could not find plugin named " + |
| 83 | pluginName); |
| 84 | } |
| 85 | |
| 86 | const std::string pluginPathNameNoExt = |
| 87 | (boost::filesystem::path(pluginPathName).parent_path() / |
| 88 | boost::filesystem::path(pluginPathName).stem()).generic_string(); |
| 89 | PluginRegPtr pluginReg( |
| 90 | PluginSpecificRegistrationContext::create(pluginName)); |
| 91 | pluginReg->setParent(*this); |
| 92 | |
| 93 | libfunc::PluginHandle plugin; |
| 94 | auto ctx = pluginReg->extractOpaquePointer(); |
| 95 | |
| 96 | bool success = tryLoadingPlugin(plugin, pluginPathName, ctx) || |
| 97 | tryLoadingPlugin(plugin, pluginPathNameNoExt, ctx, true); |
| 98 | if (!success) { |
| 99 | throw std::runtime_error( |
| 100 | "Unusual error occurred trying to load plugin named " + |
| 101 | pluginName); |
| 102 | } |
| 103 | |
| 104 | pluginReg->takePluginHandle(plugin); |
| 105 | adoptPluginRegistrationContext(pluginReg); |
| 106 | } |
| 107 | |
| 108 | void RegistrationContext::loadPlugins() { |
| 109 | // Build a list of all the plugins we can find |
nothing calls this directly
no test coverage detected