diff options
author | Shevek <[email protected]> | 2015-01-01 11:06:48 -0800 |
---|---|---|
committer | Shevek <[email protected]> | 2015-01-01 11:06:48 -0800 |
commit | 34f2c3f91099b19efc4ce4c5d26b8b8eedfb3aa8 (patch) | |
tree | 5d415c0d04cf57d9e2208e92a0f9725831f601cc /src/main/java/org | |
parent | 3e0f34f77c1ea1f9b27b097efaa8bcf3dee19e4b (diff) |
Fix #21: Allow including absolute files.
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/anarres/cpp/Preprocessor.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/org/anarres/cpp/Preprocessor.java b/src/main/java/org/anarres/cpp/Preprocessor.java index 8b1ddcc..5dacc91 100644 --- a/src/main/java/org/anarres/cpp/Preprocessor.java +++ b/src/main/java/org/anarres/cpp/Preprocessor.java @@ -1150,6 +1150,16 @@ public class Preprocessor implements Closeable { @Nonnull String name, boolean quoted, boolean next) throws IOException, LexerException { + if (name.startsWith("/")) { + VirtualFile file = filesystem.getFile(name); + if (include(file)) + return; + StringBuilder buf = new StringBuilder(); + buf.append("File not found: ").append(name); + error(line, 0, buf.toString()); + return; + } + VirtualFile pdir = null; if (quoted) { if (parent != null) { |