diff --git a/qt-cpp/src/kit-manager.ts b/qt-cpp/src/kit-manager.ts index 18fd2d2..6568093 100644 --- a/qt-cpp/src/kit-manager.ts +++ b/qt-cpp/src/kit-manager.ts @@ -43,6 +43,7 @@ export const CMAKE_GLOBAL_KITS_FILEPATH = path.join( 'cmake-tools-kits.json' ); +const envPath = '${env:PATH}'; type Environment = Record; interface CMakeGenerator { @@ -357,7 +358,7 @@ export class KitManager { } tempPath.push(value); } - tempPath.push('${env:PATH}'); + tempPath.push(envPath); // Remove duplicates const pathEnv = Array.from(new Set(tempPath)).join(path.delimiter); kit.environmentVariables = { @@ -509,12 +510,10 @@ export class KitManager { private static generateEnvPathForQtInstallation(installation: string) { if (!IsWindows) { - return undefined; + return envPath; } const installationBinDir = path.join(installation, 'bin'); - const QtPathAddition = [installationBinDir, '${env:PATH}'].join( - path.delimiter - ); + const QtPathAddition = [installationBinDir, envPath].join(path.delimiter); return QtPathAddition; } @@ -545,7 +544,8 @@ export class KitManager { newKit.name = kitName; newKit.environmentVariables = { VSCODE_QT_INSTALLATION: installation, - PATH: qtPathEnv + // If it is just envPath, not need to set it. + PATH: qtPathEnv === envPath ? undefined : qtPathEnv }; const toolchainFilePath = await promiseCmakeQtToolchainPath;