Skip to content

Commit 54d4ffe

Browse files
committed
Give preference to conda in root over conda in env
1 parent a2ed341 commit 54d4ffe

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/pet-conda/src/environments.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,18 @@ pub fn get_conda_environment_info(
140140
* This function returns the path to the conda installation that was used to create the environment.
141141
*/
142142
pub fn get_conda_installation_used_to_create_conda_env(env_path: &Path) -> Option<PathBuf> {
143-
// Possible the env_path is the root conda install folder.
144-
if is_conda_install(env_path) {
145-
return Some(env_path.to_path_buf());
146-
}
147-
148143
// If this environment is in a folder named `envs`, then the parent directory of `envs` is the root conda install folder.
149144
if let Some(parent) = env_path.ancestors().nth(2) {
150145
if is_conda_install(parent) {
151146
return Some(parent.to_path_buf());
152147
}
153148
}
154149

150+
// Possible the env_path is the root conda install folder.
151+
if is_conda_install(env_path) {
152+
return Some(env_path.to_path_buf());
153+
}
154+
155155
let conda_meta_history = env_path.join("conda-meta").join("history");
156156
if let Ok(reader) = std::fs::read_to_string(conda_meta_history.clone()) {
157157
if let Some(line) = reader.lines().map(|l| l.trim()).find(|l| {

0 commit comments

Comments
 (0)