diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lexer.l | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/lexer.l b/src/lexer.l index 459f92d..718874f 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -108,12 +108,18 @@ use[ \t\r\n>]*"<" { BEGIN(cond_use); } [^\t\r\n>]+ { filename = yytext; } ">" { BEGIN(INITIAL); - fs::path usepath = fs::path(parser_source_path) / filename; - if (!fs::exists(usepath)) { - usepath = fs::path(librarydir) / filename; - } - handle_dep(fs::absolute(usepath).string()); - parserlval.text = strdup(fs::absolute(usepath).string().c_str()); + fs::path usepath; + if (fs::path(filename).is_absolute()) { + usepath = filename; + } + else { + usepath = fs::path(parser_source_path) / filename; + if (!fs::exists(usepath)) { + usepath = fs::absolute(fs::path(librarydir) / filename); + } + } + handle_dep(usepath.string()); + parserlval.text = strdup(usepath.string().c_str()); return TOK_USE; } } @@ -192,7 +198,12 @@ void includefile() fs::path dirinfo = sourcepath(); if (!filepath.empty()) { - dirinfo /= filepath; + if (fs::path(filepath).is_absolute()) { + dirinfo = filepath; + } + else { + dirinfo /= filepath; + } } fs::path finfo = dirinfo / filename; |