[r2r_common] Do not panic in get_wanted_messages() if AMENT_PREFIX_PATH is not set
This commit is contained in:
parent
55cce8caec
commit
801d09d136
|
|
@ -148,13 +148,16 @@ pub fn get_wanted_messages() -> Vec<RosMsg> {
|
||||||
get_ros_msgs_files(&dirs)
|
get_ros_msgs_files(&dirs)
|
||||||
} else {
|
} else {
|
||||||
// Else we look for all msgs we can find using the ament prefix path.
|
// Else we look for all msgs we can find using the ament prefix path.
|
||||||
let ament_prefix_var = env::var("AMENT_PREFIX_PATH").expect("Source your ROS!");
|
if let Ok(ament_prefix_var) = env::var("AMENT_PREFIX_PATH") {
|
||||||
let paths = ament_prefix_var
|
let paths = ament_prefix_var
|
||||||
.split(':')
|
.split(':')
|
||||||
.map(Path::new)
|
.map(Path::new)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
get_ros_msgs(&paths)
|
get_ros_msgs(&paths)
|
||||||
|
} else {
|
||||||
|
vec![]
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let msgs = parse_msgs(&msgs);
|
let msgs = parse_msgs(&msgs);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue