Community
Participate
Working Groups
Build ID: I20090611-1540 + CDT 6.0.0 I have an ISymbolReader which returns paths which are relative to the underlying executable. The code in Executable.getSourceFiles() does support this pattern: [...] // Also check for relative path names and attempt to // resolve // them relative to the executable. boolean fileExists = false; try { File file = new File(filename); fileExists = file.exists(); if (fileExists) { filename = file.getCanonicalPath(); } else if (filename.startsWith(".")) { //$NON-NLS-1$ file = new File(executablePath.removeLastSegments(1).toOSString(), filename); filename = file.getCanonicalPath(); } } catch (IOException e) { // Do nothing. } [...] So with an executable having the absolute path /a/b/c/d.exe and a path ../foo.c, 'filename' will be properly resolved to '/a/b/c/foo.c'. Then the code tries to determine which kind of translation unit has to be created for this file: [...] IFile wkspFile = null; IFile sourceFile = getProject().getFile(filename); IPath sourcePath = new Path(filename); if (fileExists) { // See if this source file is already in the project. // We check this to determine if we should create a // TranslationUnit or ExternalTranslationUnit if (sourceFile.exists()) wkspFile = sourceFile; else { IFile[] filesInWP = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(sourcePath); for (int j = 0; j < filesInWP.length; j++) { if (filesInWP[j].isAccessible()) { wkspFile = filesInWP[j]; break; } } } } [...] However 'fileExists' was only set to 'true' if the path was absolute in the first place and isn't updated when 'filename' is recomputed based on the location of the executable. 'wkspFile' is not updated and remains 'null'. [...] if (wkspFile != null) tu = new TranslationUnit(cproject, wkspFile, id); else tu = new ExternalTranslationUnit(cproject, URIUtil.toURI(sourcePath), id); [...] Then an external translation unit gets created for a file that is in the workspace (meaning that a different C editor will get created when opening the same C file from outside the Executables view). If I manually force 'fileExists' to 'true' in the debugger 'wkspFile' is properly computed and a proper translation unit gets created.