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:
parent
2e490426a7
commit
e43c9eb5a9
1 changed files with 25 additions and 24 deletions
|
@ -114,36 +114,37 @@ 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(files[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Arrays.sort(files, new FILE_COMPARATOR());
|
|
||||||
final IProject preferredProject= cproject == null ? null : cproject.getProject();
|
|
||||||
IFile fileInCProject= null;
|
|
||||||
for (IFile file : files) {
|
|
||||||
// check for preferred project
|
|
||||||
final IProject project = file.getProject();
|
|
||||||
if (preferredProject != null && preferredProject.equals(project))
|
|
||||||
return getWorkspaceIFL(file);
|
return getWorkspaceIFL(file);
|
||||||
|
} else {
|
||||||
if (fileInCProject == null) {
|
Arrays.sort(files, new FILE_COMPARATOR());
|
||||||
try {
|
final IProject preferredProject= cproject == null ? null : cproject.getProject();
|
||||||
if (project.hasNature(CProjectNature.C_NATURE_ID)) {
|
IFile fileInCProject= null;
|
||||||
fileInCProject= file;
|
for (IFile file : files) {
|
||||||
|
if (file.exists()) {
|
||||||
|
// check for preferred project
|
||||||
|
final IProject project = file.getProject();
|
||||||
|
if (preferredProject != null && preferredProject.equals(project))
|
||||||
|
return getWorkspaceIFL(file);
|
||||||
|
|
||||||
|
if (fileInCProject == null) {
|
||||||
|
try {
|
||||||
|
if (project.hasNature(CProjectNature.C_NATURE_ID)) {
|
||||||
|
fileInCProject= file;
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// treat as non-c project
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
// treat as non-c project
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fileInCProject != null)
|
||||||
|
return getWorkspaceIFL(fileInCProject);
|
||||||
}
|
}
|
||||||
if (fileInCProject != null)
|
|
||||||
return getWorkspaceIFL(fileInCProject);
|
|
||||||
|
|
||||||
return getWorkspaceIFL(files[0]);
|
return getExternalIFL(absolutePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue