File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,29 @@ use std::path::{Path, PathBuf};
55
66/// conda-meta must exist as this contains a mandatory `history` file.
77pub fn is_conda_install ( path : & Path ) -> bool {
8- ( path. join ( "condabin" ) . exists ( ) || path. join ( "envs" ) . exists ( ) )
8+ if ( path. join ( "condabin" ) . exists ( ) || path. join ( "envs" ) . exists ( ) )
99 && path. join ( "conda-meta" ) . exists ( )
10+ {
11+ // For https://github.com/microsoft/vscode-python/issues/24247
12+ // Possible the env has a condabin or envs folder but its not the install directory.
13+ // & in fact its just a regular conda env.
14+ // Easy way is to check if the grand parent folder is a conda install directory.
15+ if let Some ( parent) = path. parent ( ) {
16+ if let Some ( parent) = parent. parent ( ) {
17+ // If the grand parent is a conda install directory,
18+ // then this is definitely not a conda install dir.
19+ if ( parent. join ( "condabin" ) . exists ( ) || parent. join ( "envs" ) . exists ( ) )
20+ && parent. join ( "conda-meta" ) . exists ( )
21+ {
22+ return false ;
23+ }
24+ }
25+ }
26+
27+ return true ;
28+ }
29+
30+ false
1031}
1132
1233/// conda-meta must exist as this contains a mandatory `history` file.
You can’t perform that action at this time.
0 commit comments