Calculate base_executable
(executable: Option<&PathBuf>, home_dir: &Option<PathBuf>)
| 290 | |
| 291 | /// Calculate base_executable |
| 292 | fn calculate_base_executable(executable: Option<&PathBuf>, home_dir: &Option<PathBuf>) -> String { |
| 293 | // If in venv and we have home, construct base_executable from home |
| 294 | if let (Some(exe), Some(home)) = (executable, home_dir) |
| 295 | && let Some(exe_name) = exe.file_name() |
| 296 | { |
| 297 | let base = home.join(exe_name); |
| 298 | return base.to_string_lossy().into_owned(); |
| 299 | } |
| 300 | |
| 301 | // Otherwise, base_executable == executable |
| 302 | executable |
| 303 | .map(|p| p.to_string_lossy().into_owned()) |
| 304 | .unwrap_or_default() |
| 305 | } |
| 306 | |
| 307 | /// Calculate stdlib_dir (sys._stdlib_dir) |
| 308 | /// Returns None if the stdlib directory doesn't exist |
no test coverage detected