Skip to content

Commit bea87a4

Browse files
authored
Untildify conda path from settings (#122)
Support using tilded (~) path for `condaPath` setting.
1 parent 3fac341 commit bea87a4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/managers/conda/condaUtils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
import { getConfiguration } from '../../common/workspace.apis';
2626
import { getGlobalPersistentState, getWorkspacePersistentState } from '../../common/persistentState';
2727
import which from 'which';
28-
import { shortVersion, sortEnvironments } from '../common/utils';
28+
import { shortVersion, sortEnvironments, untildify } from '../common/utils';
2929
import { pickProject } from '../../common/pickers/projects';
3030
import { CondaStrings } from '../../common/localize';
3131
import { showErrorMessage } from '../../common/errors/utils';
@@ -54,7 +54,8 @@ async function setConda(conda: string): Promise<void> {
5454

5555
export function getCondaPathSetting(): string | undefined {
5656
const config = getConfiguration('python');
57-
return config.get<string>('condaPath');
57+
const value = config.get<string>('condaPath');
58+
return (value && typeof value === 'string') ? untildify(value) : value;
5859
}
5960

6061
export async function getCondaForWorkspace(fsPath: string): Promise<string | undefined> {
@@ -113,20 +114,19 @@ async function findConda(): Promise<readonly string[] | undefined> {
113114
}
114115

115116
export async function getConda(): Promise<string> {
116-
const config = getConfiguration('python');
117-
const conda = config.get<string>('condaPath');
117+
const conda = getCondaPathSetting();
118118
if (conda) {
119119
return conda;
120120
}
121121

122122
if (condaPath) {
123-
return condaPath;
123+
return untildify(condaPath);
124124
}
125125

126126
const state = await getWorkspacePersistentState();
127127
condaPath = await state.get<string>(CONDA_PATH_KEY);
128128
if (condaPath) {
129-
return condaPath;
129+
return untildify(condaPath);
130130
}
131131

132132
const paths = await findConda();

0 commit comments

Comments
 (0)