1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Fix for 140118. Use the getLocation on the working copy's resource to the the correct filename. Also, make sure we return a null code reader when trying to include a file that's not there.

This commit is contained in:
Doug Schaefer 2006-05-04 14:38:02 +00:00
parent 65b8437bda
commit 6d991143ef
2 changed files with 5 additions and 5 deletions

View file

@ -113,14 +113,11 @@ public class GCCLanguage extends PlatformObject implements ILanguage {
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project).getAdapter(PDOM.class);
CodeReader reader;
IFile rfile = (IFile)file.getResource();
String path = rfile != null ? rfile.getLocation().toOSString() : file.getPath().toOSString();
if (file instanceof IWorkingCopy) {
// get the working copy contents
reader = new CodeReader(((IWorkingCopy)file).getOriginalElement().getPath().toOSString(), file.getContents());
reader = new CodeReader(path, file.getContents());
} else {
String path
= rfile != null
? rfile.getLocation().toOSString()
: file.getPath().toOSString();
reader = codeReaderFactory.createCodeReaderForTranslationUnit(path);
if (reader == null)
return null;

View file

@ -97,6 +97,9 @@ public class PDOMCodeReaderFactory implements ICodeReaderFactory {
// Don't parse inclusion if it is already captured
try {
try {
File file = new File(path);
if (!file.exists())
return null;
path = new File(path).getCanonicalPath();
} catch (IOException e) {
// ignore and use the path we were passed in