From e932c1d0721ec8c8fbe700e11d4a58918f8eb7bd Mon Sep 17 00:00:00 2001 From: haixuanTao Date: Fri, 26 Apr 2024 16:25:54 +0200 Subject: [PATCH] Return emptuy package vec if AMENT_PREFIX_PATH points to '' Fix https://github.com/dora-rs/dora/issues/481#issuecomment-2075193358 --- .../extensions/ros2-bridge/msg-gen/src/parser/package.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/extensions/ros2-bridge/msg-gen/src/parser/package.rs b/libraries/extensions/ros2-bridge/msg-gen/src/parser/package.rs index f05a93370..781ac65a3 100644 --- a/libraries/extensions/ros2-bridge/msg-gen/src/parser/package.rs +++ b/libraries/extensions/ros2-bridge/msg-gen/src/parser/package.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, path::Path}; +use std::{collections::HashMap, io::Empty, path::Path}; use anyhow::{Context, Result}; use glob::glob; @@ -11,6 +11,13 @@ fn get_ros_msgs_each_package>(root_dir: P) -> Result let mut map: HashMap = HashMap::new(); let ros_formats = vec!["msg", "srv", "action"]; + + if root_dir.as_ref() != Path::new("") { + let empty_vec: Vec = vec![]; + warn!("AMENT_PREFIX_PATH pointed to ''"); + return Ok(empty_vec); + } + for ros_format in ros_formats { let pattern = root_dir.as_ref().to_string_lossy().to_string() + "/**/"