Browse Source

Merge pull request #3050 from laytan/fix-load-directive-with-absolute-paths

fix load directive with absolute paths
Jeroen van Rijn 1 year ago
parent
commit
d667809e0a
1 changed files with 9 additions and 6 deletions
  1. 9 6
      src/check_builtin.cpp

+ 9 - 6
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);