mirror of
https://github.com/boostorg/dll.git
synced 2026-01-26 18:42:09 +00:00
28 lines
982 B
C++
28 lines
982 B
C++
// Copyright 2011-2013 Renato Tegon Forti.
|
|
// Copyright 2014 Renato Tegon Forti, Antony Polukhin.
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
// (See accompanying file LICENSE_1_0.txt
|
|
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
// For more information, see http://www.boost.org
|
|
|
|
#ifndef BOOST_PLUGIN_EXAMPLE_COMMON_SHARED_LIB_PATH_HPP
|
|
#define BOOST_PLUGIN_EXAMPLE_COMMON_SHARED_LIB_PATH_HPP
|
|
|
|
#include <boost/filesystem.hpp>
|
|
boost::filesystem::path shared_lib_path(const boost::filesystem::path& root, const std::wstring& filename_part) {
|
|
namespace fs = ::boost::filesystem;
|
|
fs::directory_iterator endit;
|
|
|
|
for (fs::directory_iterator it(root); it != endit; ++it) {
|
|
if (fs::is_regular_file(*it) && it->path().filename().wstring().find(filename_part) != std::wstring::npos) {
|
|
return *it;
|
|
}
|
|
}
|
|
|
|
throw std::runtime_error("Failed to find library");
|
|
}
|
|
|
|
#endif // BOOST_PLUGIN_EXAMPLE_COMMON_SHARED_LIB_PATH_HPP
|
|
|