From 64ed4389ffed678c1fea3a3522af7425357f79dc Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Wed, 27 Dec 2023 15:00:33 +0100 Subject: fix load directive with absolute paths --- src/check_builtin.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/check_builtin.cpp') diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index c0061a397..b3aaab754 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -1083,13 +1083,16 @@ gb_internal bool cache_load_file_directive(CheckerContext *c, Ast *call, String ast_node(bd, BasicDirective, ce->proc); String builtin_name = bd->name.string; - String base_dir = dir_from_path(get_file_path_string(call->file_id)); - - BlockingMutex *ignore_mutex = nullptr; - String path = {}; - bool ok = determine_path_from_string(ignore_mutex, call, base_dir, original_string, &path); - gb_unused(ok); + String path; + if (gb_path_is_absolute((char*)original_string.text)) { + path = original_string; + } else { + String base_dir = dir_from_path(get_file_path_string(call->file_id)); + BlockingMutex *ignore_mutex = nullptr; + bool ok = determine_path_from_string(ignore_mutex, call, base_dir, original_string, &path); + gb_unused(ok); + } MUTEX_GUARD(&c->info->load_file_mutex); -- cgit v1.2.3