Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMarkus Schorn2010-01-05 10:48:56 +0000
committerMarkus Schorn2010-01-05 10:48:56 +0000
commit52eeb7286846dedb12e6cbabd936f6ed721957e9 (patch)
treec928f9779a4bce620de212ba51c36e0a6915e1fc /core
parent3054286cc2348284f7422871a2bc5e9f00a9b6f5 (diff)
downloadorg.eclipse.cdt-52eeb7286846dedb12e6cbabd936f6ed721957e9.tar.gz
org.eclipse.cdt-52eeb7286846dedb12e6cbabd936f6ed721957e9.tar.xz
org.eclipse.cdt-52eeb7286846dedb12e6cbabd936f6ed721957e9.zip
Bug 126956: Absolute include directives without drive letter
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java
index 6452331ba73..956b4eea8b5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java
@@ -865,10 +865,20 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
private <T> T findInclusion(final String includeDirective, final boolean quoteInclude,
final boolean includeNext, final String currentFile, final IIncludeFileTester<T> tester) {
T reader = null;
- // filename is an absolute path or it is a Linux absolute path on a windows machine
- if (new File(includeDirective).isAbsolute() || includeDirective.startsWith("/")) { //$NON-NLS-1$
+ // Filename is an absolute path
+ if (new File(includeDirective).isAbsolute()) {
return tester.checkFile(includeDirective, false, null);
}
+ // Filename is a Linux absolute path on a windows machine
+ if (File.separatorChar == '\\' && includeDirective.length() > 0) {
+ final char firstChar = includeDirective.charAt(0);
+ if (firstChar == '\\' || firstChar == '/') {
+ if (currentFile != null && currentFile.length() > 1 && currentFile.charAt(1) == ':') {
+ return tester.checkFile(currentFile.substring(0, 2) + includeDirective, false, null);
+ }
+ return tester.checkFile(includeDirective, false, null);
+ }
+ }
if (currentFile != null && quoteInclude && !includeNext) {
// Check to see if we find a match in the current directory

Back to the top