Skip to content

Fix discovery of native conda locator #23361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions native_locator/src/conda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,11 @@ fn get_known_conda_locations(environment: &impl known::Environment) -> Vec<PathB
PathBuf::from("/home/miniconda3/bin"),
PathBuf::from("/anaconda3/bin"),
PathBuf::from("/miniconda3/bin"),
PathBuf::from("/usr/local/anaconda3/bin"),
PathBuf::from("/usr/local/miniconda3/bin"),
PathBuf::from("/usr/anaconda3/bin"),
PathBuf::from("/usr/miniconda3/bin"),
PathBuf::from("/home/anaconda3/bin"),
PathBuf::from("/home/miniconda3/bin"),
PathBuf::from("/anaconda3/bin"),
PathBuf::from("/miniconda3/bin"),
];
if let Some(home) = environment.get_user_home() {
known_paths.push(PathBuf::from(home.clone()).join("anaconda3/bin"));
known_paths.push(PathBuf::from(home).join("miniconda3/bin"));
}
known_paths.append(&mut environment.get_know_global_search_locations());
known_paths
}
Expand All @@ -201,9 +197,10 @@ fn find_conda_binary_in_known_locations(environment: &impl known::Environment) -
for location in known_locations {
for bin in &conda_bin_names {
let conda_path = location.join(bin);
let metadata = std::fs::metadata(&conda_path).ok()?;
if metadata.is_file() || metadata.is_symlink() {
return Some(conda_path);
if let Some(metadata) = std::fs::metadata(&conda_path).ok() {
if metadata.is_file() || metadata.is_symlink() {
return Some(conda_path);
}
}
}
}
Expand Down
Loading