Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf89c53

Browse files
committed
prefix ${workspaceRoot} for relative paths
1 parent 8d02364 commit cf89c53

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/client/providers/setInterpreterProvider.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ function getSearchPaths(): string[] {
3636
'C:\\Python3.5',
3737
'C:\\Python35',
3838
'C:\\Python35-32',
39+
'C:\\Anaconda',
40+
'C:\\Anaconda3',
3941
'C:\\Program Files (x86)\\Python 2.7',
4042
'C:\\Program Files (x86)\\Python 3.4',
4143
'C:\\Program Files (x86)\\Python 3.5',
@@ -44,7 +46,9 @@ function getSearchPaths(): string[] {
4446
'C:\\Program Files (x64)\\Python 3.5',
4547
'C:\\Program Files\\Python 2.7',
4648
'C:\\Program Files\\Python 3.4',
47-
'C:\\Program Files\\Python 3.5'
49+
'C:\\Program Files\\Python 3.5',
50+
'C:\\Program Files\\Anaconda',
51+
'C:\\Program Files\\Anaconda3'
4852
];
4953
} else {
5054
return ['/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin', '/sbin'];
@@ -205,6 +209,9 @@ function suggestPythonPaths(): Promise<PythonPathQuickPickItem[]> {
205209
}
206210

207211
function setPythonPath(pythonPath: string, created: boolean = false) {
212+
if (pythonPath.startsWith(vscode.workspace.rootPath)){
213+
pythonPath = path.join('${workspaceRoot}', path.relative(vscode.workspace.rootPath, pythonPath));
214+
}
208215
const settingsFile = workspaceSettingsPath();
209216
utils.validatePath(settingsFile)
210217
.then(validatedPath => {

0 commit comments

Comments
 (0)