diff options
Diffstat (limited to 'src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java')
-rw-r--r-- | src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java b/src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java index 3427467..dc2d119 100644 --- a/src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java +++ b/src/main/java/com/jogamp/gluegen/jcpp/Preprocessor.java @@ -31,6 +31,7 @@ import java.util.Map; import java.util.Set; import java.util.Stack; import java.util.TreeMap; +import java.util.regex.Matcher; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; @@ -638,10 +639,15 @@ public class Preprocessor implements Closeable { buf.append("#line ").append(line) .append(" \""); /* XXX This call to escape(name) is correct but ugly. */ - if (name == null) + if (name == null) { buf.append("<no file>"); - else - MacroTokenSource.escape(buf, name); + } else { + if( File.separatorChar != '/' && getFeature(Feature.UNIFIED_OUTPUT) ) { + MacroTokenSource.escape(buf, name.replaceAll(Matcher.quoteReplacement(File.separator), "/")); + } else { + MacroTokenSource.escape(buf, name); + } + } buf.append("\"").append(extra).append("\n"); return new Token(P_LINE, line, 0, buf.toString(), null); } |