From cf2ad6d87dc67fbbb772b5554a8de18f6beb096c Mon Sep 17 00:00:00 2001 From: Orkun Tokdemir Date: Tue, 14 Jan 2025 15:23:10 +0100 Subject: [PATCH] qt-cpp: Add the rest of the environment path to the path variable When Ninja doesn't exist in PATH and on a Unix-based system, Ninja might be used from the Qt installation. In this case, the following output is generated. Output: `"PATH": "/home/orkun/Qt/Tools/Ninja"` The problem is that the above variable overrides the PATH variable completely and it causes compilers not to be found. This commit adds the rest of the environment path to the PATH variable for Unix-based systems when Ninja is not found in PATH. --- qt-cpp/src/kit-manager.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qt-cpp/src/kit-manager.ts b/qt-cpp/src/kit-manager.ts index 5046097..6568093 100644 --- a/qt-cpp/src/kit-manager.ts +++ b/qt-cpp/src/kit-manager.ts @@ -510,7 +510,7 @@ export class KitManager { private static generateEnvPathForQtInstallation(installation: string) { if (!IsWindows) { - return undefined; + return envPath; } const installationBinDir = path.join(installation, 'bin'); const QtPathAddition = [installationBinDir, envPath].join(path.delimiter); @@ -544,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;