From 48c558488704fd8e49dc33149b34a5be1950050b Mon Sep 17 00:00:00 2001 From: Chris Recoskie Date: Tue, 5 Feb 2008 19:30:03 +0000 Subject: [PATCH] some fixes to project description manager and build system to allow EFS hosted projects to function better --- .../gnu/AbstractGCCBOPConsoleParserUtility.java | 2 +- .../model/CProjectDescriptionManager.java | 17 ++++++++++------- .../core/cdtvariables/CdtMacroSupplier.java | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParserUtility.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParserUtility.java index 075a57b1882..f13aba8fc23 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParserUtility.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParserUtility.java @@ -89,7 +89,7 @@ public abstract class AbstractGCCBOPConsoleParserUtility { protected void pushDirectory(IPath dir) { if (dir != null) { IPath pwd = null; - if (fBaseDirectory.isPrefixOf(dir)) { + if (fBaseDirectory != null && fBaseDirectory.isPrefixOf(dir)) { pwd = dir.removeFirstSegments(fBaseDirectory.segmentCount()); } else { // check if it is a cygpath diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java index 2c5cccb337d..b0278eb04d2 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java @@ -89,6 +89,7 @@ import org.eclipse.cdt.internal.core.model.CElementDelta; import org.eclipse.cdt.internal.core.model.CModelManager; import org.eclipse.cdt.internal.core.settings.model.CExternalSettinsDeltaCalculator.ExtSettingsDelta; import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.filesystem.IFileInfo; import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -1963,13 +1964,15 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=96258 URI location = rscFile.getLocationURI(); if (location != null) { - File file = toLocalFile(location, null/*no progress monitor available*/); - if (file != null && file.exists()) { - try { - stream = new FileInputStream(file); - } catch (FileNotFoundException e) { - throw ExceptionFactory.createCoreException(e); - } + IFileStore file = EFS.getStore(location); + IFileInfo info = null; + + if(file != null) { + info = file.fetchInfo(); + } + + if (info != null && info.exists()) { + stream = file.openInputStream(EFS.NONE, null); } } } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtMacroSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtMacroSupplier.java index fb972987e51..11f471287c9 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtMacroSupplier.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtMacroSupplier.java @@ -205,7 +205,7 @@ public class CdtMacroSupplier extends CoreMacroSupplierBase { macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,project.getName()); } else if("ProjDirPath".equals(macroName)){ //$NON-NLS-1$ IProject project = getProject(cfg); - if(project != null) + if(project != null && project.getLocation() != null) // in the EFS world getLocation() can return null macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,project.getLocation().toString()); } /* else if("BuildArtifactFileName".equals(macroName)){ //$NON-NLS-1$