Skip to content

Commit bf4091e

Browse files
author
Kartik Raj
authored
Skip windows store interpreters found via windows registry when discovering (#20613)
Closes #20603
1 parent ec2af99 commit bf4091e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/client/pythonEnvironments/base/locators/lowLevel/windowsRegistryLocator.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
/* eslint-disable no-continue */
12
// Copyright (c) Microsoft Corporation. All rights reserved.
23
// Licensed under the MIT License.
34

45
import { PythonEnvKind, PythonEnvSource } from '../../info';
56
import { BasicEnvInfo, IPythonEnvsIterator, Locator } from '../../locator';
67
import { getRegistryInterpreters } from '../../../common/windowsUtils';
78
import { traceError } from '../../../../logging';
9+
import { isMicrosoftStoreDir } from '../../../common/environmentManagers/microsoftStoreEnv';
810

911
export class WindowsRegistryLocator extends Locator<BasicEnvInfo> {
1012
public readonly providerId: string = 'windows-registry';
@@ -15,6 +17,12 @@ export class WindowsRegistryLocator extends Locator<BasicEnvInfo> {
1517
const interpreters = await getRegistryInterpreters();
1618
for (const interpreter of interpreters) {
1719
try {
20+
// Filter out Microsoft Store app directories. We have a store app locator that handles this.
21+
// The python.exe available in these directories might not be python. It can be a store install
22+
// shortcut that takes you to microsoft store.
23+
if (isMicrosoftStoreDir(interpreter.interpreterPath)) {
24+
continue;
25+
}
1826
const env: BasicEnvInfo = {
1927
kind: PythonEnvKind.OtherGlobal,
2028
executablePath: interpreter.interpreterPath,

0 commit comments

Comments
 (0)