Add $(dirname) to get directory of current launch file.#1103
Add $(dirname) to get directory of current launch file.#1103dirk-thomas merged 4 commits intolunar-develfrom
Conversation
|
I support this proposal. Well done, Mike! My only thought is regarding the first bullet point:
Does this imply that Either way, this can be solved with a sentence in the docs :) |
|
The patch looks good to me. Can you please add some tests (probably to |
|
@IanTheEngineer Nope, But might prefer to have something more like: @dirk-thomas Yup, tests in progress. I'll add to the unit test, but I'm thinking it would also be worthwhile to add something a bit more end-to-end to the test_roslaunch package, basically an automated version of the demonstration posted in the proposal. One other bit of bikeshedding to do— the |
Very good point. I would rather avoid overriding Python keywords in that case. Maybe |
|
Changed to |
|
Great, thank you. When you have a chance can you please mention this new feature in the wiki and post a link here for future readers to find it. |
* Add $(dir) to get directory of current launch file. * Change $(dir) -> $(dirname) * Add simple tests for $(dirname) substitution. * Add xmlloader test for $(dirname).
I'm working on adding some test coverage for this, but the basic idea for usage is allowing stuff like:
Where the output is:
Some possible use-cases for this:
$(find)— instead just$(dir)/other.launch.evalto make the a launch file do different things depending on where it's installed. For example<node .... if="$(eval dir().startswith('/opt'))" />FYI @guillaumeautran @Jin-Myung