diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-04-10 19:35:06 +0200 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-04-10 19:35:06 +0200 |
commit | 07f01d1ab5e68fc042356fd90fa07c199791b29c (patch) | |
tree | 89860e4e85ee49931b4193255de0a2032d94392e /plugin.cpp | |
parent | da2666726e48a3dc00f05589cdf4947f22deb3c3 (diff) |
Ported to Debian 10
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; } |