### Eclipse Workspace Patch 1.0 #P org.eclipse.cdt.core Index: model/org/eclipse/cdt/internal/core/model/CModelManager.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt-releng/all/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java,v retrieving revision 1.108 diff -u -r1.108 CModelManager.java --- model/org/eclipse/cdt/internal/core/model/CModelManager.java 17 Aug 2006 21:02:05 -0000 1.108 +++ model/org/eclipse/cdt/internal/core/model/CModelManager.java 23 Aug 2006 21:38:04 -0000 @@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.core.model; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -49,6 +48,7 @@ import org.eclipse.cdt.core.model.ISourceRoot; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.IWorkingCopy; +import org.eclipse.core.filesystem.*; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; @@ -404,42 +404,44 @@ if (path == null || cproject == null) { return null; } - if (path.isAbsolute()) { - File file = path.toFile(); - if (file == null || !file.isFile()) { - return null; - } - try { - IIncludeReference[] includeReferences = cproject.getIncludeReferences(); - for (int i = 0; i < includeReferences.length; i++) { - if (includeReferences[i].isOnIncludeEntry(path)) { - String id = CoreModel.getRegistedContentTypeId(cproject.getProject(), path.lastSegment()); - if (id == null) { - // fallback to C Header - id = CCorePlugin.CONTENT_TYPE_CHEADER; + try { + if (path.isAbsolute()) { + IFileInfo fi = EFS.getStore(URIUtil.toURI(path)).fetchInfo(); + if (!fi.exists() || fi.isDirectory()) + return null; + try { + IIncludeReference[] includeReferences = cproject.getIncludeReferences(); + for (int i = 0; i < includeReferences.length; i++) { + if (includeReferences[i].isOnIncludeEntry(path)) { + String id = CoreModel.getRegistedContentTypeId(cproject.getProject(), path.lastSegment()); + if (id == null) { + // fallback to C Header + id = CCorePlugin.CONTENT_TYPE_CHEADER; + } + return new ExternalTranslationUnit(includeReferences[i], path, id); } - return new ExternalTranslationUnit(includeReferences[i], path, id); } + } catch (CModelException e) { } - } catch (CModelException e) { - } - } else { - try { - IIncludeReference[] includeReferences = cproject.getIncludeReferences(); - for (int i = 0; i < includeReferences.length; i++) { - IPath includePath = includeReferences[i].getPath().append(path); - File file = includePath.toFile(); - if (file != null && file.isFile()) { - String id = CoreModel.getRegistedContentTypeId(cproject.getProject(), includePath.lastSegment()); - if (id == null) { - // fallbakc to C Header - id = CCorePlugin.CONTENT_TYPE_CHEADER; + } else { + try { + IIncludeReference[] includeReferences = cproject.getIncludeReferences(); + for (int i = 0; i < includeReferences.length; i++) { + IPath includePath = includeReferences[i].getPath().append(path); + IFileInfo fi = EFS.getStore(URIUtil.toURI(includePath)).fetchInfo(); + if (fi.exists() && (!fi.isDirectory())) { + String id = CoreModel.getRegistedContentTypeId(cproject.getProject(), includePath.lastSegment()); + if (id == null) { + // fallbakc to C Header + id = CCorePlugin.CONTENT_TYPE_CHEADER; + } + return new ExternalTranslationUnit(includeReferences[i], includePath, id); } - return new ExternalTranslationUnit(includeReferences[i], includePath, id); } + } catch (CModelException e) { } - } catch (CModelException e) { } + } catch (CoreException e) { } return null; } @@ -561,8 +563,12 @@ public IBinaryFile createBinaryFile(IFile file) { //Avoid name special devices, empty files and the like - File f = new File(file.getLocationURI()); - if (!f.isFile() || f.length() == 0) { + try { + IFileInfo fi = EFS.getStore(file.getLocationURI()).fetchInfo(); + if (fi.isDirectory() || fi.getLength() == 0) { + return null; + } + } catch (CoreException e) { return null; } Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt-releng/all/org.eclipse.cdt.core/META-INF/MANIFEST.MF,v retrieving revision 1.13 diff -u -r1.13 MANIFEST.MF --- META-INF/MANIFEST.MF 14 Jul 2006 19:46:25 -0000 1.13 +++ META-INF/MANIFEST.MF 23 Aug 2006 21:38:03 -0000 @@ -74,6 +74,7 @@ org.eclipse.core.runtime, org.eclipse.text, org.eclipse.core.variables, - org.eclipse.core.filebuffers + org.eclipse.core.filebuffers, + org.eclipse.core.filesystem Eclipse-LazyStart: true Bundle-RequiredExecutionEnvironment: J2SE-1.4