Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt-cpp: Add the rest of the environment path to the path variable #32

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions qt-cpp/src/kit-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const CMAKE_GLOBAL_KITS_FILEPATH = path.join(
'cmake-tools-kits.json'
);

const envPath = '${env:PATH}';
type Environment = Record<string, string | undefined>;

interface CMakeGenerator {
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down
Loading