rootcx_platform/env.rs
1use std::path::Path;
2
3pub const PATH_SEP: char = if cfg!(windows) { ';' } else { ':' };
4
5pub fn prepend_path(dir: &Path) -> String {
6 let mut path = dir.display().to_string();
7 if let Ok(existing) = std::env::var("PATH") {
8 path = format!("{path}{PATH_SEP}{existing}");
9 }
10 path
11}
12
13pub fn dylib_path_var() -> Option<&'static str> {
14 if cfg!(target_os = "macos") { Some("DYLD_LIBRARY_PATH") }
15 else if cfg!(target_os = "linux") { Some("LD_LIBRARY_PATH") }
16 else { None }
17}