Fix Bundled drivers on MacOS taking precedence
authorCharles Giessen <charles@lunarg.com>
Mon, 5 Dec 2022 19:21:59 +0000 (12:21 -0700)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Mon, 9 Jan 2023 23:25:53 +0000 (16:25 -0700)
Previous commits broke the behavior of only using bundled drivers if found,
this commit fixes the condition to make sure the bundled drivers are used while
no other drivers are loaded.

loader/loader.c

index e6bf8bd44ce3ae646a0d31a9fc4b8b4d514be915..c1af4a31ba65c9259f57d4f613c85b30f08a79cf 100644 (file)
@@ -1611,15 +1611,13 @@ static void loader_expand_path(const char *path, const char *rel_base, size_t ou
 // @return - A string in out_fullpath of either the full path or file.
 static void loader_get_fullpath(const char *file, const char *in_dirs, size_t out_size, char *out_fullpath) {
     if (!loader_platform_is_path(file) && *in_dirs) {
-        char *dirs_copy, *dir, *next_dir;
-
-        dirs_copy = loader_stack_alloc(strlen(in_dirs) + 1);
+        char *dirs_copy = loader_stack_alloc(strlen(in_dirs) + 1);
         strcpy(dirs_copy, in_dirs);
 
         // find if file exists after prepending paths in given list
         // for (dir = dirs_copy; *dir && (next_dir = loader_get_next_path(dir)); dir = next_dir) {
-        dir = dirs_copy;
-        next_dir = loader_get_next_path(dir);
+        char *dir = dirs_copy;
+        char *next_dir = loader_get_next_path(dir);
         while (*dir && next_dir) {
             loader_platform_combine_path(out_fullpath, out_size, dir, file, NULL);
             if (loader_platform_file_exists(out_fullpath)) {
@@ -3036,8 +3034,7 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in
                         memcpy(cur_path_ptr, relative_location, rel_size);
                         cur_path_ptr += rel_size;
                         *cur_path_ptr++ = PATH_SEPARATOR;
-                        // only for ICD manifests
-                        if (override_env != NULL && manifest_type == LOADER_DATA_FILE_MANIFEST_DRIVER) {
+                        if (manifest_type == LOADER_DATA_FILE_MANIFEST_DRIVER) {
                             use_first_found_manifest = true;
                         }
                     }