mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 09:15:38 +02:00
incorrect source lookup fallback when file is not in workspace
Change-Id: I9f7c5f3c46a26053123d28f30a7b8712eb8c9254
This commit is contained in:
parent
04bf520618
commit
9e38beb510
1 changed files with 14 additions and 11 deletions
|
@ -285,7 +285,10 @@ public class SourceUtils {
|
||||||
if (lcProject != null) {
|
if (lcProject != null) {
|
||||||
ICProject project = CoreModel.getDefault().create(lcProject);
|
ICProject project = CoreModel.getDefault().create(lcProject);
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
return new ITranslationUnit[] { CoreModel.getDefault().createTranslationUnitFrom(project, URIUtil.toURI(file.getCanonicalPath(), true)) };
|
ITranslationUnit translationUnit = CoreModel.getDefault().createTranslationUnitFrom(project,
|
||||||
|
URIUtil.toURI(file.getCanonicalPath(), true));
|
||||||
|
if (translationUnit != null) // if we failed do not return array with null in it
|
||||||
|
return new ITranslationUnit[] { translationUnit };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) { // ignore if getCanonicalPath throws
|
} catch (IOException e) { // ignore if getCanonicalPath throws
|
||||||
|
|
Loading…
Add table
Reference in a new issue