Skip to content

Commit 7759e8a

Browse files
committed
Clean up
1 parent ddafd94 commit 7759e8a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/client/interpreter/locators/services/condaHelper.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ function parseCondaEnvFileLine(line: string): { name: string; path: string; isAc
9595
// form as the environment name. lastIndexOf() can also be used but that assumes
9696
// that `path` does NOT end with 5*spaces.
9797
let spaceIndex = line.indexOf(' ');
98+
if (spaceIndex === -1) {
99+
// This means the environment name is longer than 17 characters and it is
100+
// active. Try ' * ' for separator between name and path.
101+
spaceIndex = line.indexOf(' * ');
102+
}
103+
98104
if (spaceIndex > 0) {
99105
// Parsing `name`
100106
// > `conda create -n <name>`
@@ -117,14 +123,6 @@ function parseCondaEnvFileLine(line: string): { name: string; path: string; isAc
117123
remainder = line.substring(spaceIndex);
118124
}
119125

120-
// This means the environment name is longer than 17 characters and it is
121-
// active. Try ' * ' for separator between name and path.
122-
if (spaceIndex === -1) {
123-
spaceIndex = line.indexOf(' * ');
124-
name = line.substring(0, spaceIndex).trimRight();
125-
remainder = line.substring(spaceIndex);
126-
}
127-
128126
// Detecting Active Environment:
129127
// Only active environment will have `*` between `name` and `path`. `name`
130128
// or `path` can have `*` in them as well. So we have to look for `*` in

0 commit comments

Comments
 (0)