Hi Doug,
The answer to both appears to be "no".
I probably should mention, that after running the code mentioned in my original email on this thread, despite it appearing to be successful, I don't see the added paths in the UI.
With that said, if i manually add them to the UI (which prompts me for a reindex), the "Unresolved inclusion" marker still shows up in the source file.
I should also note that I am adding the paths as absolute paths, even though in this case they point to directories that are in the workspace (to other projects). Possibly an interesting observation is when I add one of the paths, I am seeing a "warning"
icon next to it. I don't see the same icon on the other path. I haven't yet determined what the warning is trying to tell me. Both paths exist.
Thanks,
Richard
From: cdt-dev-bounces@xxxxxxxxxxx <cdt-dev-bounces@xxxxxxxxxxx> on behalf of Doug Schaefer <dschaefer@xxxxxxxxxxxxxx>
Sent: Monday, March 27, 2017 10:08 AM
To: CDT General developers list.
Subject: Re: [cdt-dev] Programmatically adding additional include paths for indexer
Hey Richard, does it work if you add the paths in the UI? Does a project Reindex help?
Doug.
Hi All,
I am attempting to programmatically add additional header files paths to a project. Ideally I'd like the added paths to appear in the UI (i.e. properties->C/C++ General->Paths and Symbols->Includes), but even if not, at least I'd like to make the indexer
happy. Without the additional paths, it currently shows the "Unresolved inclusion" marker.
Here is the code I am using at the moment, which I found from a post a few years ago which seems to be happy, but so far the indexer is still showing the same marker.
IPath someHeaderFilePath = new Path("/some/absolute/path");
IPath someOtherHeaderFilePath = new Path("/some/other/workspaceRelative/path");
ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(getProject(), true);
ICConfigurationDescription configDecriptions[] = projectDescription.getConfigurations();
for (ICConfigurationDescription configDescription : configDecriptions) {
ICFolderDescription projectRoot = configDescription.getRootFolderDescription();
ICLanguageSetting[] settings = projectRoot.getLanguageSettings();
for (ICLanguageSetting setting : settings) {
List<ICLanguageSettingEntry> includes = new ArrayList<ICLanguageSettingEntry>();
includes.addAll(setting.getSettingEntriesList(ICSettingEntry.INCLUDE_PATH));
includes.add(new CIncludePathEntry(someHeaderFilePath, ICSettingEntry.LOCAL));
includes.add(new CIncludePathEntry(someOtherHeaderFilePath, ICSettingEntry.LOCAL));
setting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, includes);
// Set information to project description
ManagedBuildManager.saveBuildInfo(getProject(), true);
}
}
Thanks,
Richard
|