diff options
Diffstat (limited to 'plugin.cpp')
-rw-r--r-- | plugin.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -1,5 +1,12 @@ #include "plugin.h" +#include <boost/beast/version.hpp> + +// Support both boost in Debian unstable (BOOST_LATEST) and in stable (boost 1.67) +#if BOOST_VERSION >= 107100 +#define BOOST_LATEST +#endif + #include <boost/dll/import.hpp> #include <boost/filesystem.hpp> @@ -22,7 +29,11 @@ void PluginLoader::load_plugins() for (auto& path: fs::recursive_directory_iterator(dir)) { if (path.is_regular_file() && path.path().extension() == ".so"s) { +#ifdef BOOST_LATEST dll::fs::path lib_path{path.path()}; +#else + boost::filesystem::path lib_path{path.path().generic_string()}; +#endif try { boost::shared_ptr<webserver_plugin_interface> plugin = dll::import<webserver_plugin_interface>(lib_path, "webserver_plugin", dll::load_mode::append_decorations); @@ -31,7 +42,7 @@ void PluginLoader::load_plugins() throw std::runtime_error("Bad interface version for "s + path.path().generic_string() + ": "s + std::to_string(plugin->version()) + " vs. "s + std::to_string(webserver_plugin_interface::interface_version)); std::string name{plugin->name()}; - if (m_plugins.contains(name)) + if (m_plugins.find(name) != m_plugins.end()) throw std::runtime_error("Plugin already exists: "s + name); std::cout << "Found plugin: " << name << " (" << path.path().string() << "), "; @@ -76,7 +87,7 @@ bool PluginLoader::validate_config() std::string plugin {it->second}; // check if plugin exists - if (!m_plugins.contains(plugin)) { + if (m_plugins.find(plugin) == m_plugins.end()) { std::cout << "Configured plugin " << plugin << " not found" << std::endl; return false; } |