Skip to content
Snippets Groups Projects
Commit 7b76c701 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

plugins: look for HPP_PLUGIN_DIRS

parent d42bbbc5
No related branches found
No related tags found
No related merge requests found
Pipeline #43920 passed
......@@ -82,8 +82,11 @@ class ProblemSolverPlugin {
namespace plugin {
/// Find the absolute path to a library named name.
/// \param name
/// \return name if it is an absolute path. Otherwise, for each path in
/// LD_LIBRARY_PATH environment variable, look for path/hppPlugins/name.
/// \return name if it is an absolute path.
/// Otherwise, for each path in HPP_PLUGIN_DIRS environment variable,
/// look for path/hppPlugins/name.
/// Otherwise, for each path in LD_LIBRARY_PATH environment variable,
/// look for path/hppPlugins/name.
/// \throw std::invalid_argument if not valid file found.
std::string findPluginLibrary(const std::string& name);
......
......@@ -42,6 +42,15 @@ namespace core {
namespace plugin {
std::string findPluginLibrary(const std::string& name) {
if (fs::path(name).is_absolute()) return name;
std::vector<std::string> ppaths =
::pinocchio::extractPathFromEnvVar("HPP_PLUGIN_DIRS", ":");
for (std::size_t i = 0; i < ppaths.size(); ++i) {
fs::path lib(ppaths[i]);
lib /= "hppPlugins";
lib /= name;
if (fs::is_regular_file(lib)) return lib.native();
}
std::vector<std::string> ldpaths =
::pinocchio::extractPathFromEnvVar("LD_LIBRARY_PATH", ":");
for (std::size_t i = 0; i < ldpaths.size(); ++i) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment