Skip to content

Commit

Permalink
Validate Compiler Paths Against PATH Environment Variable in Configur…
Browse files Browse the repository at this point in the history
…ation UI (#11913)

* resolve compiler against envrionment variables

* fix lint issue
  • Loading branch information
browntarik authored Feb 1, 2024
1 parent 9229952 commit b742a19
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Extension/src/LanguageServer/configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1536,9 +1536,15 @@ export class CppProperties {

// Check if config name is unique.
errors.name = this.isConfigNameUnique(config.name);

let resolvedCompilerPath: string | undefined;
// Validate compilerPath
let resolvedCompilerPath: string | undefined = this.resolvePath(config.compilerPath);
if (config.compilerPath) {
resolvedCompilerPath = which.sync(config.compilerPath, { nothrow: true }) ?? undefined;
}

if (resolvedCompilerPath === undefined) {
resolvedCompilerPath = this.resolvePath(config.compilerPath);
}
const settings: CppSettings = new CppSettings(this.rootUri);
const compilerPathAndArgs: util.CompilerPathAndArgs = util.extractCompilerPathAndArgs(!!settings.legacyCompilerArgsBehavior, resolvedCompilerPath);
if (resolvedCompilerPath
Expand Down

0 comments on commit b742a19

Please sign in to comment.