From efbe11870eb8c486af11a40ddc35d54b5d2599ba Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Tue, 20 Jan 2009 02:33:33 +0000 Subject: [PATCH] Bug 261459. --- .../cdt/core/index/IndexLocationFactory.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IndexLocationFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IndexLocationFactory.java index 683c6ec378f..4db7a6f2133 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IndexLocationFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IndexLocationFactory.java @@ -11,16 +11,20 @@ *******************************************************************************/ package org.eclipse.cdt.core.index; +import java.io.File; import java.net.URI; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.internal.core.index.IndexFileLocation; import org.eclipse.cdt.internal.core.resources.ResourceLookup; +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -63,7 +67,21 @@ public class IndexLocationFactory { * URI is not a filesystem path. */ public static IPath getAbsolutePath(IIndexFileLocation location) { - return URIUtil.toPath(location.getURI()); + IPath path = URIUtil.toPath(location.getURI()); + // Workaround for platform bug http://bugs.eclipse.org/bugs/show_bug.cgi?id=261457 + if (path == null) { + try { + IFileStore store = EFS.getStore(location.getURI()); + if (store == null) + return null; + File file = store.toLocalFile(EFS.NONE, null); + if (file == null) + return null; + path = new Path(file.getAbsolutePath()); + } catch (CoreException e) { + } + } + return path; } /**