diff --git a/r2r_common/src/lib.rs b/r2r_common/src/lib.rs index ebd3d015e..be6e57acd 100644 --- a/r2r_common/src/lib.rs +++ b/r2r_common/src/lib.rs @@ -63,19 +63,19 @@ pub fn setup_bindgen_builder() -> bindgen::Builder { } let ament_prefix_var_name = "AMENT_PREFIX_PATH"; + let split_char = if cfg!(target_os = "windows") { + ';' + } else { + ':' + }; let ament_prefix_var = { let mut ament_str = env::var_os(ament_prefix_var_name).expect("Source your ROS!"); if let Some(cmake_prefix_var) = env::var_os("CMAKE_PREFIX_PATH") { - ament_str.push(";"); + ament_str.push(&split_char.to_string()); ament_str.push(cmake_prefix_var); } RawOsString::new(ament_str) }; - let split_char = if cfg!(target_os = "windows") { - ';' - } else { - ':' - }; for p in ament_prefix_var.split(split_char) { let path = Path::new(&p.to_os_str()).join("include");