Skip to content

Commit da207a3

Browse files
committed
Fixed warning
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
1 parent e7e6329 commit da207a3

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/my_publisher.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,27 @@ int main(int argc, char ** argv)
5858
point_cloud_transport::Publisher pub = pct.advertise("pct/point_cloud", 100);
5959

6060
const std::string bagged_cloud_topic = "/point_cloud";
61-
const std::string shared_directory = ament_index_cpp::get_package_share_directory(
62-
"point_cloud_transport_tutorial");
63-
std::string bag_file = shared_directory + "/resources/rosbag2_2023_08_05-16_08_51";
61+
std::filesystem::path shared_directory;
62+
ament_index_cpp::get_package_share_directory(
63+
"point_cloud_transport_tutorial",
64+
shared_directory);
65+
std::filesystem::path bag_file = shared_directory / "resources" /
66+
"rosbag2_2023_08_05-16_08_51";
6467

6568
if (argc > 1) {
66-
bag_file = argv[1];
69+
bag_file = std::filesystem::path(argv[1]);
6770
}
6871

6972
if (!std::filesystem::exists(bag_file)) {
70-
std::cout << "Not able to open file [" << bag_file << "]" << '\n';
73+
std::cout << "Not able to open file [" << bag_file.string() << "]" << '\n';
7174
return -1;
7275
}
7376

74-
std::cout << "Reading [" << bag_file << "] bagfile" << '\n';
77+
std::cout << "Reading [" << bag_file.string() << "] bagfile" << '\n';
7578

7679
// boiler-plate to tell rosbag2 how to read our bag
7780
rosbag2_storage::StorageOptions storage_options;
78-
storage_options.uri = bag_file;
81+
storage_options.uri = bag_file.string();
7982
storage_options.storage_id = "mcap";
8083
rosbag2_cpp::ConverterOptions converter_options;
8184
converter_options.input_serialization_format = "cdr";

0 commit comments

Comments
 (0)