mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 13:55:39 +02:00
Fall Back the project Location for the working directory.
Catch exception in findFilePath().
This commit is contained in:
parent
5ccf0b609f
commit
efa4e2ca1d
1 changed files with 11 additions and 2 deletions
|
@ -88,7 +88,9 @@ public class ErrorParserManager extends OutputStream {
|
||||||
if (fDirectoryStack.size() != 0) {
|
if (fDirectoryStack.size() != 0) {
|
||||||
return (IPath) fDirectoryStack.lastElement();
|
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) {
|
public void pushDirectory(IPath dir) {
|
||||||
|
@ -244,7 +246,14 @@ public class ErrorParserManager extends OutputStream {
|
||||||
} else {
|
} else {
|
||||||
path = (IPath) getWorkingDirectory().append(filePath);
|
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;
|
return (file != null && file.exists()) ? file : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue