Helper function to retrieve a sequence of paths from an environment variable.
(env_variable_name: &str)
| 438 | |
| 439 | /// Helper function to retrieve a sequence of paths from an environment variable. |
| 440 | fn get_paths(env_variable_name: &str) -> impl Iterator<Item = String> + '_ { |
| 441 | env::var_os(env_variable_name) |
| 442 | .filter(|v| !v.is_empty()) |
| 443 | .into_iter() |
| 444 | .flat_map(move |paths| { |
| 445 | split_paths(&paths) |
| 446 | .map(|path| { |
| 447 | path.into_os_string() |
| 448 | .into_string() |
| 449 | .unwrap_or_else(|_| panic!("{env_variable_name} isn't valid unicode")) |
| 450 | }) |
| 451 | .collect::<Vec<_>>() |
| 452 | }) |
| 453 | } |
| 454 | |
| 455 | #[cfg(not(target_os = "wasi"))] |
| 456 | pub(crate) use env::split_paths; |
no test coverage detected