summaryrefslogtreecommitdiffhomepage
path: root/plugin.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-04-10 19:35:06 +0200
committerRoland Reichwein <mail@reichwein.it>2020-04-10 19:35:06 +0200
commit07f01d1ab5e68fc042356fd90fa07c199791b29c (patch)
tree89860e4e85ee49931b4193255de0a2032d94392e /plugin.cpp
parentda2666726e48a3dc00f05589cdf4947f22deb3c3 (diff)
Ported to Debian 10
Diffstat (limited to 'plugin.cpp')
-rw-r--r--plugin.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/plugin.cpp b/plugin.cpp
index db0632d..a29e2f0 100644
--- a/plugin.cpp
+++ b/plugin.cpp
@@ -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;
}