Calculate exec_prefix
(exe_dir: &Option<PathBuf>, prefix: &str)
| 267 | |
| 268 | /// Calculate exec_prefix |
| 269 | fn calculate_exec_prefix(exe_dir: &Option<PathBuf>, prefix: &str) -> String { |
| 270 | #[cfg(windows)] |
| 271 | { |
| 272 | // Windows: exec_prefix == prefix |
| 273 | let _ = exe_dir; // silence unused warning |
| 274 | prefix.to_owned() |
| 275 | } |
| 276 | |
| 277 | #[cfg(not(windows))] |
| 278 | { |
| 279 | // POSIX: search for lib-dynload directory |
| 280 | if let Some(dir) = exe_dir { |
| 281 | let landmark = platform::platstdlib_landmark(); |
| 282 | if let Some(exec_prefix) = search_up_dir(dir, &[&landmark]) { |
| 283 | return exec_prefix.to_string_lossy().into_owned(); |
| 284 | } |
| 285 | } |
| 286 | // Fallback: same as prefix |
| 287 | prefix.to_owned() |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | /// Calculate base_executable |
| 292 | fn calculate_base_executable(executable: Option<&PathBuf>, home_dir: &Option<PathBuf>) -> String { |
no test coverage detected