Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Ryall2006-06-15 15:39:04 +0000
committerKen Ryall2006-06-15 15:39:04 +0000
commit7c32c381ed57214b13b12e8b3841ee4c1e5b4bd3 (patch)
treed80de951dd800959ed4fed8157516b4531bcea0f
parente539d8c06dc8ba94f04f2226af82a1f837099a96 (diff)
downloadorg.eclipse.cdt-7c32c381ed57214b13b12e8b3841ee4c1e5b4bd3.tar.gz
org.eclipse.cdt-7c32c381ed57214b13b12e8b3841ee4c1e5b4bd3.tar.xz
org.eclipse.cdt-7c32c381ed57214b13b12e8b3841ee4c1e5b4bd3.zip
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.
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java28
1 files changed, 18 insertions, 10 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java
index 4301e45a5f..9d1e8ccb5a 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java
@@ -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;
}

Back to the top