From cdd0c897ac7b9b05ff67b3bd24afed8696c86c80 Mon Sep 17 00:00:00 2001 From: John Cortell Date: Tue, 15 Dec 2009 00:18:34 +0000 Subject: [PATCH] Avoid unwanted conversion from a UNIX path to c:\ on Windows, just as with 297781 --- .../org/eclipse/cdt/internal/core/model/Binary.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 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 e7d2a457daf..80e63c1d9d7 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 @@ -37,6 +37,7 @@ import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.internal.core.resources.ResourceLookup; import org.eclipse.cdt.internal.core.util.MementoTokenizer; +import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.Assert; @@ -339,8 +340,16 @@ public class Binary extends Openable implements IBinary { TranslationUnit tu; if (wkspFile != null) tu = new TranslationUnit(this, wkspFile, id); - else - tu = new ExternalTranslationUnit(this, Path.fromOSString(filename), id); + else { + IPath path = Path.fromOSString(filename); + if (path.toFile().exists()) { + tu = new ExternalTranslationUnit(this, path, id); + } + else { + // filename may be a UNIX path; don't convert to c:\ on Windows. + tu = new ExternalTranslationUnit(this, URIUtil.toURI(filename), id); + } + } if (! info.includesChild(tu)) info.addChild(tu);