1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Follow up for symbolic links in include search path, bug 246524.

This commit is contained in:
Markus Schorn 2008-09-17 09:15:13 +00:00
parent 2e490426a7
commit e43c9eb5a9

View file

@ -114,17 +114,16 @@ public class IndexLocationFactory {
*/ */
public static IIndexFileLocation getIFLExpensive(ICProject cproject, String absolutePath) { public static IIndexFileLocation getIFLExpensive(ICProject cproject, String absolutePath) {
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(absolutePath)); IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(absolutePath));
switch(files.length) { if (files.length==1) {
case 0: IFile file = files[0];
return getExternalIFL(absolutePath); if (file.exists())
case 1: return getWorkspaceIFL(file);
return getWorkspaceIFL(files[0]); } else {
}
Arrays.sort(files, new FILE_COMPARATOR()); Arrays.sort(files, new FILE_COMPARATOR());
final IProject preferredProject= cproject == null ? null : cproject.getProject(); final IProject preferredProject= cproject == null ? null : cproject.getProject();
IFile fileInCProject= null; IFile fileInCProject= null;
for (IFile file : files) { for (IFile file : files) {
if (file.exists()) {
// check for preferred project // check for preferred project
final IProject project = file.getProject(); final IProject project = file.getProject();
if (preferredProject != null && preferredProject.equals(project)) if (preferredProject != null && preferredProject.equals(project))
@ -140,10 +139,12 @@ public class IndexLocationFactory {
} }
} }
} }
}
if (fileInCProject != null) if (fileInCProject != null)
return getWorkspaceIFL(fileInCProject); return getWorkspaceIFL(fileInCProject);
}
return getWorkspaceIFL(files[0]); return getExternalIFL(absolutePath);
} }
/** /**