Skip to content

Commit

Permalink
Fix IGN_LAUNCH_PLUGIN_PATH logic
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <methylDragon@gmail.com>
  • Loading branch information
methylDragon committed May 26, 2022
1 parent feb94cd commit b380a40
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/Manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1096,12 +1096,12 @@ void ManagerPrivate::LoadPlugin(const tinyxml2::XMLElement *_elem)
std::string homePath;
gz::common::env(IGN_HOMEDIR, homePath);

// TODO(CH3): Deprecated. Remove on ticktock.
systemPaths.AddPluginPaths(
gz::common::joinPaths(homePath, ".ignition", "gazebo", "plugins"));
gz::common::joinPaths(homePath, ".gz", "sim", "plugins"));

// TODO(CH3): Deprecated. Remove on ticktock.
systemPaths.AddPluginPaths(
gz::common::joinPaths(homePath, ".gz", "sim", "plugins"));
gz::common::joinPaths(homePath, ".ignition", "gazebo", "plugins"));

std::string pathToLib;
if (common::exists(file))
Expand All @@ -1115,7 +1115,18 @@ void ManagerPrivate::LoadPlugin(const tinyxml2::XMLElement *_elem)
// This tries to find one more time with IGN_LAUNCH_PLUGIN_PATH instead of
// GZ_LAUNCH_PLUGIN_PATH
systemPaths.SetPluginPathEnv("IGN_LAUNCH_PLUGIN_PATH");

systemPaths.AddPluginPaths(
gz::common::joinPaths(homePath, ".ignition", "gazebo", "plugins"));

pathToLib = systemPaths.FindSharedLibrary(file);

if (!pathToLib.empty())
{
gzwarn << "Found plugin [" << pathToLib
<< "] using deprecated environment variable [IGN_LAUNCH_PLUGIN_PATH]."
" Please use [GZ_LAUNCH_PLUGIN_PATH] instead." << std::endl;
}
}

if (pathToLib.empty())
Expand All @@ -1125,12 +1136,6 @@ void ManagerPrivate::LoadPlugin(const tinyxml2::XMLElement *_elem)
<< "variable.\n";
return;
}
else
{
gzwarn << "Found plugin [" << pathToLib
<< "] using deprecated environment variable [IGN_LAUNCH_PLUGIN_PATH]."
" Please use [GZ_LAUNCH_PLUGIN_PATH] instead." << std::endl;
}

plugin::Loader loader;
std::unordered_set<std::string> localPlugins = loader.LoadLib(pathToLib);
Expand Down

0 comments on commit b380a40

Please sign in to comment.