From efa4e2ca1d3b8255f7aac27787b7cb6fb39450ff Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Thu, 19 Dec 2002 19:20:18 +0000 Subject: [PATCH] Fall Back the project Location for the working directory. Catch exception in findFilePath(). --- .../org/eclipse/cdt/core/ErrorParserManager.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java index 2bd710ccb63..26ba0ab0514 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java @@ -88,7 +88,9 @@ public class ErrorParserManager extends OutputStream { if (fDirectoryStack.size() != 0) { return (IPath) fDirectoryStack.lastElement(); } - return new Path(""); + // Fallback to the Project Location + // FIXME: if the build did not start in the Project ? + return fProject.getLocation(); } public void pushDirectory(IPath dir) { @@ -244,7 +246,14 @@ public class ErrorParserManager extends OutputStream { } else { path = (IPath) getWorkingDirectory().append(filePath); } - IFile file = (path.isAbsolute()) ? fProject.getWorkspace().getRoot().getFileForLocation(path) : fProject.getFile(path); + + IFile file = null; + // The workspace may throw an IllegalArgumentException + // Catch it and the parser will fallback to scan the entire project. + try { + file = (path.isAbsolute()) ? fProject.getWorkspace().getRoot().getFileForLocation(path) : fProject.getFile(path); + } catch (Exception e) { + } return (file != null && file.exists()) ? file : null; }