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

Normalize all paths sent to cpptools #1103

Merged
merged 1 commit into from
Mar 2, 2020
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
10 changes: 6 additions & 4 deletions src/cpptools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,15 @@ export class CppConfigurationProvider implements cpt.CustomConfigurationProvider
if (!comp_path) {
throw new MissingCompilerException();
}
const normalizedCompilerPath = util.platformNormalizePath(comp_path);
const flags = fileGroup.compileFlags ? [...shlex.split(fileGroup.compileFlags)] : target.compileFlags;
const {standard, extraDefinitions} = parseCompileFlags(flags, lang);
const defines = (fileGroup.defines || target.defines).concat(extraDefinitions);
const includePath = fileGroup.includePath ? fileGroup.includePath.map(p => p.path) : target.includePath;
const normalizedIncludePath = includePath.map(p => util.platformNormalizePath(p));

const newBrowsePath = this._workspaceBrowseConfiguration.browsePath;
for (const includePathItem of includePath) {
for (const includePathItem of normalizedIncludePath) {
if (newBrowsePath.indexOf(includePathItem) < 0) {
newBrowsePath.push(includePathItem);
}
Expand All @@ -283,16 +285,16 @@ export class CppConfigurationProvider implements cpt.CustomConfigurationProvider
this._workspaceBrowseConfiguration = {
browsePath: newBrowsePath,
standard,
compilerPath: comp_path || undefined,
compilerPath: normalizedCompilerPath || undefined,
compilerArgs: flags || undefined
};

return {
defines,
standard,
includePath,
includePath: normalizedIncludePath,
intelliSenseMode: getIntelliSenseMode(comp_path),
compilerPath: comp_path || undefined,
compilerPath: normalizedCompilerPath || undefined,
compilerArgs: flags || undefined
};
}
Expand Down