@@ -497,7 +497,7 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
497497 search_paths.push_back (get_executable_path ());
498498 search_paths.push_back (fs::current_path ());
499499 } else {
500- search_paths.push_back (user_search_path);
500+ search_paths.push_back (fs::u8path ( user_search_path) );
501501 }
502502
503503 int best_score = 0 ;
@@ -511,9 +511,9 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
511511 fs::directory_iterator dir_it (search_path, fs::directory_options::skip_permission_denied);
512512 for (const auto & entry : dir_it) {
513513 if (entry.is_regular_file ()) {
514- auto filename = entry.path ().filename (). native () ;
515- auto ext = entry.path ().extension (). native () ;
516- if (filename.find (file_prefix) == 0 && ext == file_extension) {
514+ auto filename = entry.path ().filename ();
515+ auto ext = entry.path ().extension ();
516+ if (filename.native (). find (file_prefix) == 0 && ext == file_extension) {
517517 dl_handle_ptr handle { dl_load_library (entry) };
518518 if (!handle && !silent) {
519519 GGML_LOG_ERROR (" %s: failed to load %s\n " , __func__, path_str (entry.path ()).c_str ());
@@ -544,7 +544,7 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
544544 // try to load the base backend
545545 for (const auto & search_path : search_paths) {
546546 fs::path filename = backend_filename_prefix ().native () + name_path.native () + backend_filename_extension ().native ();
547- fs::path path = search_path. native () + filename. native () ;
547+ fs::path path = search_path / filename;
548548 if (fs::exists (path)) {
549549 return get_reg ().load_backend (path, silent);
550550 }
0 commit comments