Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Programmatically retrieving the discovered include directories of the active profile

Hi Andrea

I think this is the old scanner discovery info that you are getting. You can try using the language settings instead, see org.eclipse.cdt.core.model.CoreModel.isScannerInformationEmpty for an example.

Here's an little example I made based on isScannerInformationEmpty:

ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(file.getProject());
if (des != null){
    ICConfigurationDescription indexCfg = des.getDefaultSettingConfiguration();
    List<String> languageIds = LanguageSettingsManager.getLanguages(file, indexCfg);
    for (String langId : languageIds) {
        List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesByKind(indexCfg, file, langId,
                ICSettingEntry.INCLUDE_PATH | ICSettingEntry.MACRO | ICSettingEntry.INCLUDE_FILE | ICSettingEntry.MACRO_FILE);
        Arrays.toString(entries.toArray());
    }
}

Hope this helps,
Marc-Andre


From: cdt-dev-bounces@xxxxxxxxxxx [cdt-dev-bounces@xxxxxxxxxxx] on behalf of Andrea [eclipse@xxxxxxxxxx]
Sent: Wednesday, 26 August 2015 8:00 PM
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] Programmatically retrieving the discovered include directories of the active profile

I already asked this question on the forum, but I received no answer. I guess it wasn't the right place to ask after all.
I'm writing a code checker, and I would like to find out what the discovered include directories are. I have been looking at it for some hours, but I couldn't find many solutions. I could basically only come up with something like this:

IConfiguration configuration = ManagedBuildManager.getBuildInfo( file ).getDefaultConfiguration();
PathInfo projectPathInfo = CfgDiscoveredPathManager.getInstance().getDiscoveredInfo( file.getProject(), new CfgInfoContext( configuration ) );
IPath[] defaultIncludeDirs = projectPathInfo.getIncludePaths();



This gives an empty list.
Is looks strange to me that this is not easily doable. I'm not sure I'm missing something. I would be glad to receive some hints. Thanks

Back to the top