From bbd56cf6e6800a851d92e90e8378f8695cb69d85 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Wed, 1 Feb 2023 00:55:18 +0530 Subject: [PATCH] Skip windows store interpreters found via windows registry when discovering --- .../base/locators/lowLevel/windowsRegistryLocator.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/client/pythonEnvironments/base/locators/lowLevel/windowsRegistryLocator.ts b/src/client/pythonEnvironments/base/locators/lowLevel/windowsRegistryLocator.ts index cb59c1e49a60..d589231cc7ca 100644 --- a/src/client/pythonEnvironments/base/locators/lowLevel/windowsRegistryLocator.ts +++ b/src/client/pythonEnvironments/base/locators/lowLevel/windowsRegistryLocator.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-continue */ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. @@ -5,6 +6,7 @@ import { PythonEnvKind, PythonEnvSource } from '../../info'; import { BasicEnvInfo, IPythonEnvsIterator, Locator } from '../../locator'; import { getRegistryInterpreters } from '../../../common/windowsUtils'; import { traceError } from '../../../../logging'; +import { isMicrosoftStoreDir } from '../../../common/environmentManagers/microsoftStoreEnv'; export class WindowsRegistryLocator extends Locator { public readonly providerId: string = 'windows-registry'; @@ -15,6 +17,12 @@ export class WindowsRegistryLocator extends Locator { const interpreters = await getRegistryInterpreters(); for (const interpreter of interpreters) { try { + // Filter out Microsoft Store app directories. We have a store app locator that handles this. + // The python.exe available in these directories might not be python. It can be a store install + // shortcut that takes you to microsoft store. + if (isMicrosoftStoreDir(interpreter.interpreterPath)) { + continue; + } const env: BasicEnvInfo = { kind: PythonEnvKind.OtherGlobal, executablePath: interpreter.interpreterPath,