diff --git a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/ErrorParserFileMatchingTest.java b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/ErrorParserFileMatchingTest.java index 10722b6ff79..b38170bb329 100644 --- a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/ErrorParserFileMatchingTest.java +++ b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/ErrorParserFileMatchingTest.java @@ -1279,5 +1279,25 @@ public class ErrorParserFileMatchingTest extends TestCase { assertEquals(1,problemMarkerInfo.lineNumber); assertEquals("error",problemMarkerInfo.description); } + + /** + * Checks if a file from error output can be found. + * + * @throws Exception... + */ + public void testWindowsPathOnLinux_Bug263977() throws Exception { + String fileName = "testWindowsPathOnLinux_Bug263977.c"; + + ResourceHelper.createFolder(fProject, "Folder/Subfolder"); + ResourceHelper.createFile(fProject, "Folder/Subfolder/"+fileName); + + // Note that main intention of this test is to run on *Linux*, see bug 263977 + parseOutput("W:\\Folder\\Subfolder\\"+fileName+":1:error"); + assertEquals(1, errorList.size()); + + ProblemMarkerInfo problemMarkerInfo = errorList.get(0); + assertEquals("L/FindMatchingFilesTest/Folder/Subfolder/"+fileName,problemMarkerInfo.file.toString()); + assertEquals("error",problemMarkerInfo.description); + } } 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 01c8fdc05a4..115752d03ae 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 @@ -346,13 +346,15 @@ public class ErrorParserManager extends OutputStream { org.eclipse.core.filesystem.URIUtil.equals(getWorkingDirectoryURI(), cachedWorkingDirectory)) return cachedFile; - IPath path = new Path(partialLoc); + // To be able to parse Windows paths on Linux systems, see bug 263977 + IPath path = new Path(partialLoc.replace('\\', IPath.SEPARATOR)); // Try to find exact match. If path is not absolute - searching in working directory. IFile file = findFileInWorkspace(path); // Try to find best match considering known partial path if (file==null) { + path = path.setDevice(null); IProject[] prjs = new IProject[] { fProject }; IFile[] files = ResourceLookup.findFilesByName(path, prjs, false); if (files.length == 0)