Repository navigation
Extend API to use std::filesystem - #104
Conversation
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
|
Nice to see this, will review soon! |
| auto resource_path = path + "/share/ament_index/resource_index/" + | ||
| resource_type + "/" + resource_name; |
There was a problem hiding this comment.
| auto resource_path = path + "/share/ament_index/resource_index/" + | |
| resource_type + "/" + resource_name; | |
| auto resource_path = path / "share" / "ament_index" / "resource_index" / | |
| resource_type / resource_name; |
Would it be time to also do changes like this?
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
|
There is still one function which required deprecation which is |
|
@ros-pull-request-builder retest this please |
|
do you mind to take a look ? @mjcarroll @asymingt |
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
|
Pulls: ros/pluginlib#289, #104, ros/resource_retriever#118, ros/ros_tutorials#190, ros-perception/image_common#388, ros2/rclcpp#3011, ros2/rmw_implementation#272, ros2/rmw_zenoh#879, ros2/rosbag2#2268, ros2/rviz#1647 |
| * \throws std::runtime_error if resource_type or resource_name are empty. | ||
| */ | ||
| AMENT_INDEX_CPP_PUBLIC | ||
| std::pair<std::optional<std::filesystem::path>, std::string> |
There was a problem hiding this comment.
I am not the biggest fan of std::pair as return type.
A small struct like
| std::pair<std::optional<std::filesystem::path>, std::string> | |
| struct PathWithResource | |
| { | |
| std::optional<std::filesystem::path> resourcePath; | |
| // ? | |
| std::string contents; | |
| } |
is nicer and makes the code using the return type way more understandable.
Also from the documentation I can't figure out what contents is / should contain.
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
|
Pulls: ros/pluginlib#289, #104, ros/resource_retriever#118, ros/ros_tutorials#190, ros-perception/image_common#388, ros2/rclcpp#3011, ros2/rmw_implementation#272, ros2/rmw_zenoh#879, ros2/rosbag2#2268, ros2/rviz#1647 |
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
|
Would you consider backporting this (without the deprecations) to Jazzy and Kilted? It seems to me most of the changes are just adding new free functions, so it should be API and ABI compatible. |
|
@peci1 I don't see a reason against it, feel free to open a PR |
|
I thought mergifio could do it, but I can't task it =) |
|
Mergify won't filter out the deprecation, therefore it needs to be a manual backport |
|
Okay, I'll have a look ;) |
You can use mergify to start and then edit the code before merge. |
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
|
Okay, I went with Jazzy manually: #109 . I'll do Kilted once Jazzy is merged. |
Signed-off-by: Alejandro Hernández Cordero <[email protected]> Signed-off-by: Martin Pecka <[email protected]> Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Alejandro Hernández Cordero <[email protected]> Signed-off-by: Martin Pecka <[email protected]> Co-authored-by: Alejandro Hernández Cordero <[email protected]> (cherry picked from commit 1bba98c)
Signed-off-by: Alejandro Hernández Cordero <[email protected]> Signed-off-by: Martin Pecka <[email protected]> Co-authored-by: Alejandro Hernández Cordero <[email protected]> (cherry picked from commit 1bba98c)
(cherry picked from commit 1bba98c) Signed-off-by: Alejandro Hernández Cordero <[email protected]> Signed-off-by: Martin Pecka <[email protected]> Co-authored-by: Martin Pecka <[email protected]> Co-authored-by: Alejandro Hernández Cordero <[email protected]>
| */ | ||
| AMENT_INDEX_CPP_PUBLIC | ||
| void | ||
| get_package_prefix(const std::string & package_name, std::filesystem::path & path); |
There was a problem hiding this comment.
Why is the result an argument and not an output of the function?
Now my code is more verbose because I need to construct an empty path first to pass it to this function.
This:
auto dbc = ament_index_cpp::get_package_share_directory("can_dbc_pkg") + "/test/motohawk.dbc";Becomes this:
std::filesystem::path package_path;
ament_index_cpp::get_package_share_directory("can_dbc_pkg", package_path);
auto dbc = package_path / "test" / "motohawk.dbc";To keep ABI perhaps we could have also just created a different function name? How about get_package_share_path:
auto dbc = ament_index_cpp::get_package_share_path("can_dbc_pkg") / "test" / "motohawk.dbc";There was a problem hiding this comment.
I think this was because you can't have two functions with the same args and different result type. So there was need to distinguish the new API somehow else.
But I agree the solution with renaming the function is much friendlier.
Migrate to non-deprecated ament_index_cpp APIs introduced in ament/ament_index#104 to fix -Werror=deprecated-declarations errors. Signed-off-by: Daisuke Sato <[email protected]>
Temporarily disable deprecation warning-as-error for QT and ament_target_dependencies deprecation warnings
…:path (#3703) * Update deprecated usage of get_package_share * Add include guards for ament/ament_index#104 --------- Co-authored-by: Stephanie Eng <[email protected]> Co-authored-by: Nathan Brooks <[email protected]> Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
... ament/ament_index#104 This was backported to jazzy / kilted
... ament/ament_index#104 This was backported to jazzy / kilted
Related with this issue #92
@Ryanf55 FYI