aboutsummaryrefslogtreecommitdiffhomepage
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/lex.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/c/lex.c b/c/lex.c
index 6099539..459aecd 100644
--- a/c/lex.c
+++ b/c/lex.c
@@ -1786,12 +1786,14 @@ ppinclude(struct lexer *lx, const struct span *span0)
expecteol(lx, "include");
joinspan(&span.ex, tk.span.ex);
if (tk.t == TKPPHDRQ) {
- /* try raw path: absolute or relative to working dir */
- xbgrow(&path, tk.len + 1);
- memcpy(path, tk.s, tk.len);
- path[tk.len] = 0;
- if (tryinclude(lx, &span, path)) return;
- if (tk.s[0] == '/') goto NotFound;
+ if (tk.s[0] == '/') {
+ /* try absolute path */
+ xbgrow(&path, tk.len + 1);
+ memcpy(path, tk.s, tk.len);
+ path[tk.len] = 0;
+ if (tryinclude(lx, &span, path)) return;
+ goto NotFound;
+ }
/* try relative to current file's directory */
base = getfilename(lx->fileid, 0);