diff --git a/Migration.md b/Migration.md index 5832cd950..3215d2aa1 100644 --- a/Migration.md +++ b/Migration.md @@ -5,6 +5,10 @@ Deprecated code produces compile-time warnings. These warning serve as notification to users that their code should be upgraded. The next major release will remove the deprecated code. +## Ignition GUI 6.X to 7.X + +* The environment variable `IGN_GUI_PLUGIN_PATH` is deprecated. Use `GZ_GUI_PLUGIN_PATH` instead. + ## Ignition GUI 6.2 to 6.3 * New QML dependencies, only needed for the NavSatMap plugin: `qml-module-qtlocation`, `qml-module-qtpositioning` diff --git a/examples/plugin/custom_context_menu/README.md b/examples/plugin/custom_context_menu/README.md index d1b15d2c6..ba6bf428a 100644 --- a/examples/plugin/custom_context_menu/README.md +++ b/examples/plugin/custom_context_menu/README.md @@ -10,10 +10,10 @@ Standalone cd build - export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -s CustomContext + export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -s CustomContext Or open an empty window and insert from menu cd build - export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui + export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui # Choose CustomContext from menu diff --git a/examples/plugin/dialog_from_plugin/README.md b/examples/plugin/dialog_from_plugin/README.md index 3428cb24f..d8388f34d 100644 --- a/examples/plugin/dialog_from_plugin/README.md +++ b/examples/plugin/dialog_from_plugin/README.md @@ -13,10 +13,10 @@ a modal dialog attached to the main window from a plugin. Standalone cd build - export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -s DialogFromPlugin + export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -s DialogFromPlugin Or open an empty window and insert from menu cd build - export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui + export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui # Choose DialogFromPlugin from menu diff --git a/examples/plugin/hello_plugin/README.md b/examples/plugin/hello_plugin/README.md index 68308bab4..7e8e7a712 100644 --- a/examples/plugin/hello_plugin/README.md +++ b/examples/plugin/hello_plugin/README.md @@ -13,16 +13,16 @@ configuration from XML. Standalone: cd build - export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -s HelloPlugin + export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -s HelloPlugin Within a window where other plugins can also be inserted, using a custom configuration: cd build - export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -c ../HelloPlugin.config + export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -c ../HelloPlugin.config Or open an empty window and insert from menu: cd build - export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui + export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui # Choose HelloPlugin from menu diff --git a/examples/plugin/ign_components/README.md b/examples/plugin/ign_components/README.md index bee793933..9737c224d 100644 --- a/examples/plugin/ign_components/README.md +++ b/examples/plugin/ign_components/README.md @@ -13,11 +13,11 @@ useful for downstream developers. Standalone: cd build - export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -s IgnComponents + export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -s IgnComponents Within a window where other plugins can also be inserted, using a custom configuration: cd build - export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -c ../IgnComponents.config + export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -c ../IgnComponents.config diff --git a/examples/plugin/multiple_qml/README.md b/examples/plugin/multiple_qml/README.md index 63f70102a..02fb824f6 100644 --- a/examples/plugin/multiple_qml/README.md +++ b/examples/plugin/multiple_qml/README.md @@ -12,5 +12,5 @@ This example shows how to compose a single plugin from multiple QML files. Quickly check try your plugin as follows: cd build - export IGN_GUI_PLUGIN_PATH=`pwd`; ign gui -s MultipleQml + export GZ_GUI_PLUGIN_PATH=`pwd`; ign gui -s MultipleQml diff --git a/src/Application.cc b/src/Application.cc index 745f614f5..69b8a2ddd 100644 --- a/src/Application.cc +++ b/src/Application.cc @@ -56,8 +56,12 @@ namespace ignition /// these until it is ok to unload the plugin's shared library. public: std::vector> pluginsAdded; + /// \brief Deprecated environment variable which holds paths to look for + /// plugins + public: std::string pluginPathEnvDeprecated = "IGN_GUI_PLUGIN_PATH"; + /// \brief Environment variable which holds paths to look for plugins - public: std::string pluginPathEnv = "IGN_GUI_PLUGIN_PATH"; + public: std::string pluginPathEnv = "GZ_GUI_PLUGIN_PATH"; /// \brief Vector of paths to look for plugins public: std::vector pluginPaths; @@ -192,7 +196,7 @@ Application::~Application() std::swap(this->dataPtr->pluginsToAdd, empty); this->dataPtr->pluginsAdded.clear(); this->dataPtr->pluginPaths.clear(); - this->dataPtr->pluginPathEnv = "IGN_GUI_PLUGIN_PATH"; + this->dataPtr->pluginPathEnv = "GZ_GUI_PLUGIN_PATH"; } ///////////////////////////////////////////////// @@ -435,9 +439,23 @@ bool Application::LoadPlugin(const std::string &_filename, auto pathToLib = systemPaths.FindSharedLibrary(_filename); if (pathToLib.empty()) { - ignerr << "Failed to load plugin [" << _filename << - "] : couldn't find shared library." << std::endl; - return false; + // Try deprecated environment variable + common::SystemPaths systemPathsDep; + systemPathsDep.SetPluginPathEnv(this->dataPtr->pluginPathEnvDeprecated); + pathToLib = systemPathsDep.FindSharedLibrary(_filename); + if (pathToLib.empty()) + { + ignerr << "Failed to load plugin [" << _filename << + "] : couldn't find shared library." << std::endl; + return false; + } + else + { + ignwarn << "Found plugin [" << _filename + << "] using deprecated environment variable [" + << this->dataPtr->pluginPathEnvDeprecated << "]. Please use [" + << this->dataPtr->pluginPathEnv << "] instead." << std::endl; + } } // Load plugin @@ -699,6 +717,13 @@ std::vector>> // 1. Paths from env variable auto paths = common::SystemPaths::PathsFromEnv(this->dataPtr->pluginPathEnv); + // 1.5 Paths from deprecated env variable + auto pathsDeprecated = + common::SystemPaths::PathsFromEnv(this->dataPtr->pluginPathEnvDeprecated); + + for (auto const &path : pathsDeprecated) + paths.push_back(path); + // 2. Paths added by calling addPluginPath for (auto const &path : this->dataPtr->pluginPaths) paths.push_back(path); diff --git a/tutorials/03_plugins.md b/tutorials/03_plugins.md index df98479ef..ce4183a8d 100644 --- a/tutorials/03_plugins.md +++ b/tutorials/03_plugins.md @@ -17,7 +17,7 @@ for an example. Ignition GUI will look for plugins on the following paths, in this order: -1. All paths set on the `IGN_GUI_PLUGIN_PATH` environment variable +1. All paths set on the `GZ_GUI_PLUGIN_PATH` environment variable 2. All paths added by calling `ignition::gui::addPluginPath` 3. `~/.ignition/gui/plugins` 4. [Plugins which are installed with Ignition GUI](https://ignitionrobotics.org/api/gui/6.0/namespaceignition_1_1gui_1_1plugins.html)