diff --git a/Migration.md b/Migration.md index 836a6ead..7d5de6f4 100644 --- a/Migration.md +++ b/Migration.md @@ -5,4 +5,11 @@ 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 Launch 2.2.2 + +- Environment variable `IGN_LAUNCH_CONFIG_PATH` started to be treated as a path + list (colon-separated on Linux, semicolon-separated on Windows). Before, only + a single path could be set here, and setting a path list would break the whole + launch file lookup functionality. + ## Ignition Launch 0.X to N.M diff --git a/src/cmdlaunch.rb.in b/src/cmdlaunch.rb.in index 6d872c05..45f1b005 100755 --- a/src/cmdlaunch.rb.in +++ b/src/cmdlaunch.rb.in @@ -159,26 +159,35 @@ class Cmd end if options.key?('file') - # Check if the passed in file exists. + # Check if the passed in file exists. + path = '' if File.exists?(options['file']) path = options['file'] + end # If not, then first check the IGN_LAUNCH_CONFIG_PATH environment # variable, then the configuration path from the launch library. - else + if path.empty? configPathEnv = ENV['IGN_LAUNCH_CONFIG_PATH'] - if !configPathEnv.nil? && - File.exists?(File.join(configPathEnv, options['file'])) - path = File.join(configPathEnv, options['file']) - # get the configuration path from the launch library. - else - Importer.extern 'char *configPath()' - path = File.join(Importer.configPath().to_s, options['file']) - if !File.exists?(path) - puts "Unable to find file " + options['file'] - exit(-1) + if !configPathEnv.nil? + configPaths = configPathEnv.split(File::PATH_SEPARATOR) + for configPath in configPaths + filePath = File.join(configPath, options['file']) + if File.exists?(filePath) + path = filePath + break + end end end end + # get the configuration path from the launch library. + if path.empty? + Importer.extern 'char *configPath()' + path = File.join(Importer.configPath().to_s, options['file']) + end + if path.empty? or !File.exists?(path) + puts "Unable to find file " + options['file'] + exit(-1) + end # ERB parse the file with the variable bindings begin diff --git a/tutorials.md.in b/tutorials.md.in index 0b62683d..0247b72a 100644 --- a/tutorials.md.in +++ b/tutorials.md.in @@ -6,6 +6,8 @@ Ignition @IGN_DESIGNATION_CAP@ library and how to use the library effectively. **Tutorials** +1. \subpage basics "Ignition launch tutorial" + ## License The code associated with this documentation is licensed under an [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). diff --git a/tutorials/tutorial.md b/tutorials/tutorial.md index 5e72eacf..42e3d0a3 100644 --- a/tutorials/tutorial.md +++ b/tutorials/tutorial.md @@ -1,4 +1,4 @@ -# Ignition launch tutorial +\page basics Ignition launch tutorial Ignition Launch is used to run and manage plugins and programs. A configuration script can be used to specify which programs and plugins to execute. Alternatively, individual programs and plugins can be run from the command line. @@ -55,3 +55,17 @@ The [worldName] command line argument is optional. If left blank, or not specifi Example to load `the shapes.sdf`: `ign launch gazebo_plugins.ign worldName:=shapes` + +## Launch file lookup + +There is a lookup process happening if the specified file is not an absolute +path. It searches for a file with the given name in paths as follows: + +1. current directory +1. all paths specified in environment variable `IGN_LAUNCH_CONFIG_PATH` +1. a hardcoded install location (usually + `/usr/share/ignition/ignition-launchN/configs/`) + +The `IGN_LAUNCH_CONFIG_PATH` environment variable can contain either a single +path or a path list (_new since 2.2.2_). Path list is a colon-separated (on +UNIX) or semicolon-separated (on Windows) list of absolute paths. \ No newline at end of file