1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Fix for 155088

This commit is contained in:
David Daoust 2006-08-25 19:53:26 +00:00
parent d0cb4c3a58
commit e89a4f0149

View file

@ -147,16 +147,27 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
} }
CCommandDSC cmd = fUtil.getNewCCommandDSC(genericLine.toString(), extensionsIndex > 0); CCommandDSC cmd = fUtil.getNewCCommandDSC(genericLine.toString(), extensionsIndex > 0);
IPath buildDirectory = fUtil.getWorkingDirectory(); IPath baseDirectory = fUtil.getBaseDirectory();
if (buildDirectory.isPrefixOf(pFilePath)) { if (baseDirectory.isPrefixOf(pFilePath)) {
List cmdList = new ArrayList(); List cmdList = new ArrayList();
cmdList.add(cmd); cmdList.add(cmd);
Map sc = new HashMap(1); Map sc = new HashMap(1);
sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList); sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList);
IPath relPath = pFilePath.removeFirstSegments(buildDirectory.segmentCount()); IPath relPath = pFilePath.removeFirstSegments(baseDirectory.segmentCount());
//Note: We add the scannerconfig even if the resource doesnt actually
//exist below this project (which may happen when reading existing
//build logs, because resources can be created as part of the build
//and may not exist at the time of analyzing the config but re-built
//later on.
//if (getProject().exists(relPath)) {
IFile file = getProject().getFile(relPath); IFile file = getProject().getFile(relPath);
getCollector().contributeToScannerConfig(file, sc); getCollector().contributeToScannerConfig(file, sc);
} else {
//TODO limiting to pathes below this project means not being
//able to work with linked resources. Linked resources could
//be checked through IWorkspaceRoot.findFilesForLocation().
TraceUtil.outputError("Build command for file outside project: "+pFilePath.toString(), line); //$NON-NLS-1$
} }
// fUtil.addGenericCommandForFile2(longFileName, genericLine); // fUtil.addGenericCommandForFile2(longFileName, genericLine);
} }