ament / ament_index

Apache License 2.0
13 stars 27 forks source link

Add get_package_share_path method #73

Closed DLu closed 3 years ago

DLu commented 3 years ago

Rather than all the ugliness of os.path.join I would much rather write simpler python in my launch files, so rather than

import os
from ament_index_python.packages import get_package_share_directory
...
bringup_dir = get_package_share_directory('testpkg')
urdf_path = os.path.join(bringup_dir, 'urdf', 'doggo.urdf')

you could just write

from ament_index_python.packages import get_package_share_path
...
urdf_path = get_package_share_path('testpkg') / 'urdf/doggo.urdf'
DLu commented 3 years ago

@audrow Linter is happy and now there's a test.

audrow commented 3 years ago
audrow commented 3 years ago

Thanks for the PR @DLu!