diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2023-12-27 15:00:33 +0100 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2023-12-27 15:00:33 +0100 |
| commit | 64ed4389ffed678c1fea3a3522af7425357f79dc (patch) | |
| tree | 50b7d74a947d343cab8012492e7e9f499d3eb796 /src/check_builtin.cpp | |
| parent | e52cc73d50b088c5c899e656f29e3717f4d104d7 (diff) | |
fix load directive with absolute paths
Diffstat (limited to 'src/check_builtin.cpp')
| -rw-r--r-- | src/check_builtin.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
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); |