Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

Commit 1f09fd1

Browse files
committed
also persist in the case no executable / resource is found
1 parent cadff0c commit 1f09fd1

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

tools/roslaunch/src/roslaunch/substitution_args.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -144,27 +144,24 @@ def _find(resolved, a, args, context):
144144
rp = _get_rospack()
145145
if path:
146146
source_path_to_packages = rp.get_custom_cache('source_path_to_packages', {})
147+
res = None
147148
try:
148149
res = _find_executable(
149150
resolve_without_path, a, [args[0], path], context,
150151
source_path_to_packages=source_path_to_packages)
151152
except SubstitutionException:
152153
pass
153-
else:
154-
# persist mapping of packages in rospack instance
155-
if source_path_to_packages:
156-
rp.set_custom_cache('source_path_to_packages', source_path_to_packages)
157-
return res
158-
try:
159-
res = _find_resource(
160-
resolve_without_path, a, [args[0], path], context,
161-
source_path_to_packages=source_path_to_packages)
162-
except SubstitutionException:
163-
pass
164-
else:
165-
# persist mapping of packages in rospack instance
166-
if source_path_to_packages:
167-
rp.set_custom_cache('source_path_to_packages', source_path_to_packages)
154+
if res is None:
155+
try:
156+
res = _find_resource(
157+
resolve_without_path, a, [args[0], path], context,
158+
source_path_to_packages=source_path_to_packages)
159+
except SubstitutionException:
160+
pass
161+
# persist mapping of packages in rospack instance
162+
if source_path_to_packages:
163+
rp.set_custom_cache('source_path_to_packages', source_path_to_packages)
164+
if res is not None:
168165
return res
169166
pkg_path = rp.get_path(args[0])
170167
if path:

0 commit comments

Comments
 (0)