From 07f01d1ab5e68fc042356fd90fa07c199791b29c Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 10 Apr 2020 19:35:06 +0200 Subject: Ported to Debian 10 --- plugin.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'plugin.cpp') 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 + +// Support both boost in Debian unstable (BOOST_LATEST) and in stable (boost 1.67) +#if BOOST_VERSION >= 107100 +#define BOOST_LATEST +#endif + #include #include @@ -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 plugin = dll::import(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; } -- cgit v1.2.3