From b380a40dc58c62b2b293ef1d78c9f797de56b79f Mon Sep 17 00:00:00 2001 From: methylDragon Date: Thu, 26 May 2022 16:08:16 -0700 Subject: [PATCH] Fix `IGN_LAUNCH_PLUGIN_PATH` logic Signed-off-by: methylDragon --- src/Manager.cc | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Manager.cc b/src/Manager.cc index b77c485c..b710d498 100644 --- a/src/Manager.cc +++ b/src/Manager.cc @@ -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)) @@ -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()) @@ -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 localPlugins = loader.LoadLib(pathToLib);