Skip to content

Commit 7f239eb

Browse files
committed
Allow passing additional search paths from env var
1 parent ee5bf52 commit 7f239eb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/resolve_robotics_uri_py/resolve_robotics_uri_py.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,20 @@ def resolve_robotics_uri(
9595
Note:
9696
By default the function will look for the file in the
9797
default search paths specified by the environment variables in `SupportedEnvVars`.
98-
98+
9999
If the `package_dirs` argument is provided, the model is also searched in the folders
100100
specified in `package_dirs` . In particular if a file is specified by the uri
101-
`package://ModelName/meshes/mesh.stl`, and the actual file is in
101+
`package://ModelName/meshes/mesh.stl`, and the actual file is in
102102
`/usr/local/share/ModelName/meshes/mesh.stl`, the `package_dirs` should contain `/usr/local/share`.
103103
"""
104104
package_dirs = package_dirs if isinstance(package_dirs, list) else [package_dirs]
105105

106+
# Add additional search paths from the RRU_ADDITIONAL_PATHS environment variable
107+
if additional_paths := os.getenv("RRU_ADDITIONAL_PATHS"):
108+
# Split the paths by os.pathsep and add them to the package_dirs
109+
package_dirs += additional_paths.split(os.pathsep)
110+
package_dirs = list({path for path in package_dirs if path and path != ""})
111+
106112
# If the URI has no scheme, use by default file:// which maps the resolved input
107113
# path to a URI with empty authority
108114
if not any(uri.startswith(scheme) for scheme in SupportedSchemes):

0 commit comments

Comments
 (0)