From 7411d71fbde5d652f04cc8851ed93bd15513968b Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Thu, 15 Jan 2026 12:11:02 +0000 Subject: Some docs for plugins, among other things. --- src/parser/parser_stmt.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/parser/parser_stmt.c') diff --git a/src/parser/parser_stmt.c b/src/parser/parser_stmt.c index 227b5aa..24dfa10 100644 --- a/src/parser/parser_stmt.c +++ b/src/parser/parser_stmt.c @@ -3551,6 +3551,22 @@ ASTNode *parse_import(ParserContext *ctx, Lexer *l) strncpy(plugin_name, plugin_tok.start + 1, name_len); plugin_name[name_len] = '\0'; + if (plugin_name[0] == '.' && + (plugin_name[1] == '/' || (plugin_name[1] == '.' && plugin_name[2] == '/'))) + { + char *current_dir = xstrdup(g_current_filename); + char *last_slash = strrchr(current_dir, '/'); + if (last_slash) + { + *last_slash = 0; + char resolved_path[1024]; + snprintf(resolved_path, sizeof(resolved_path), "%s/%s", current_dir, plugin_name); + free(plugin_name); + plugin_name = xstrdup(resolved_path); + } + free(current_dir); + } + // Check for optional "as alias" char *alias = NULL; Token as_tok = lexer_peek(l); -- cgit v1.2.3