1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Fix for 142465. Attempt to resolve relative path source file entries. Also check to make sure we can get valid ids for all files before making a TranslationUnit for them.

This commit is contained in:
Ken Ryall 2006-06-15 15:39:04 +00:00
parent e539d8c06d
commit 7c32c381ed

View file

@ -289,13 +289,18 @@ public class Binary extends Openable implements IBinary {
// class.
// So make sure the path is canonical, otherwise breakpoints
// won't be resolved, etc..
// Also check for relative path names and attempt to resolve
// them relative to the executable.
File file = new File(filename);
if (file.exists()) {
try {
try {
File file = new File(filename);
if (file.exists()) {
filename = file.getCanonicalPath();
} else if (filename.startsWith(".")) {
file = new File(obj.getPath().removeLastSegments(1).toOSString(), filename);
filename = file.getCanonicalPath();
} catch (IOException e) {
}
} catch (IOException e) { // Do nothing.
}
// See if this source file is already in the project.
@ -323,13 +328,16 @@ public class Binary extends Openable implements IBinary {
String id = CoreModel.getRegistedContentTypeId(sourceFile
.getProject(), sourceFile.getName());
TranslationUnit tu;
if (wkspFile != null)
tu = new TranslationUnit(this, wkspFile, id);
else
tu = new ExternalTranslationUnit(this, path, id);
if (id != null)
{ // Don't add files we can't get an ID for.
TranslationUnit tu;
if (wkspFile != null)
tu = new TranslationUnit(this, wkspFile, id);
else
tu = new ExternalTranslationUnit(this, path, id);
info.addChild(tu);
info.addChild(tu);
}
}
return true;
}