mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 15:25:49 +02:00
bug 323011: [Scanner Discovery] Source files with drive-relative paths ("/foo/bar.c") are not discovered
This commit is contained in:
parent
065dca29f4
commit
7620872563
1 changed files with 23 additions and 4 deletions
|
@ -182,10 +182,24 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
|
||||||
|
|
||||||
public List<String> translateRelativePaths(IFile file, String fileName, List<String> includes) {
|
public List<String> translateRelativePaths(IFile file, String fileName, List<String> includes) {
|
||||||
List<String> translatedIncludes = new ArrayList<String>(includes.size());
|
List<String> translatedIncludes = new ArrayList<String>(includes.size());
|
||||||
for (Iterator<String> i = includes.iterator(); i.hasNext(); ) {
|
for (String include : includes) {
|
||||||
String include = i.next();
|
|
||||||
IPath includePath = new Path(include);
|
IPath includePath = new Path(include);
|
||||||
if (!includePath.isAbsolute() && !includePath.isUNC()) { // do not translate UNC paths
|
if (includePath.isUNC()) {
|
||||||
|
// do not translate UNC paths
|
||||||
|
} else if (includePath.isAbsolute()) {
|
||||||
|
if (includePath.getDevice()==null) {
|
||||||
|
String device = getWorkingDirectory().getDevice();
|
||||||
|
IPath candidatePath = includePath.setDevice(device);
|
||||||
|
File dir = candidatePath.toFile();
|
||||||
|
if (dir.exists()) {
|
||||||
|
include = candidatePath.toString();
|
||||||
|
} else {
|
||||||
|
final String error = MakeMessages.getString("ConsoleParser.Nonexistent_Include_Path_Error_Message"); //$NON-NLS-1$
|
||||||
|
TraceUtil.outputError(error, include);
|
||||||
|
// generateMarker(file, -1, error+include, IMarkerGenerator.SEVERITY_WARNING, fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// First try the current working directory
|
// First try the current working directory
|
||||||
IPath cwd = getWorkingDirectory();
|
IPath cwd = getWorkingDirectory();
|
||||||
if (!cwd.isAbsolute()) {
|
if (!cwd.isAbsolute()) {
|
||||||
|
@ -193,7 +207,12 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
|
||||||
}
|
}
|
||||||
|
|
||||||
IPath filePath = new Path(fileName);
|
IPath filePath = new Path(fileName);
|
||||||
if (!filePath.isAbsolute()) {
|
if (filePath.isAbsolute()) {
|
||||||
|
if (filePath.getDevice()==null) {
|
||||||
|
String device = getWorkingDirectory().getDevice();
|
||||||
|
filePath = filePath.setDevice(device);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// check if the cwd is the right one
|
// check if the cwd is the right one
|
||||||
// appending fileName to cwd should yield file path
|
// appending fileName to cwd should yield file path
|
||||||
filePath = cwd.append(fileName);
|
filePath = cwd.append(fileName);
|
||||||
|
|
Loading…
Add table
Reference in a new issue