Skip to content

Commit 3f09f60

Browse files
author
Elaheh Rashedi
authored
fix for validating cl compiler path (#5196)
bug fix 5151
1 parent b5fc4cc commit 3f09f60

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Extension/src/common.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,9 +847,9 @@ export function extractCompilerPathAndArgs(inputCompilerPath?: string, inputComp
847847
let additionalArgs: string[] = [];
848848
let isWindows: boolean = os.platform() === 'win32';
849849
if (compilerPath) {
850-
if (compilerPath === "cl.exe") {
850+
if (compilerPath.endsWith("\\cl.exe") || compilerPath.endsWith("/cl.exe") || compilerPath === "cl.exe") {
851851
// Input is only compiler name, this is only for cl.exe
852-
compilerName = compilerPath;
852+
compilerName = path.basename(compilerPath);
853853

854854
} else if (compilerPath.startsWith("\"")) {
855855
// Input has quotes around compiler path
@@ -881,6 +881,7 @@ export function extractCompilerPathAndArgs(inputCompilerPath?: string, inputComp
881881
additionalArgs = additionalArgs.filter((arg: string) => arg.trim().length !== 0); // Remove empty args.
882882
compilerPath = potentialCompilerPath;
883883
}
884+
compilerName = path.basename(compilerPath);
884885
}
885886
// Get compiler name if there are no args but path is valid or a valid path was found with args.
886887
if (compilerPath === "cl.exe" || checkFileExistsSync(compilerPath)) {

0 commit comments

Comments
 (0)