@@ -497,7 +497,7 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
497
497
search_paths.push_back (get_executable_path ());
498
498
search_paths.push_back (fs::current_path ());
499
499
} else {
500
- search_paths.push_back (user_search_path);
500
+ search_paths.push_back (fs::u8path ( user_search_path) );
501
501
}
502
502
503
503
int best_score = 0 ;
@@ -511,9 +511,9 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
511
511
fs::directory_iterator dir_it (search_path, fs::directory_options::skip_permission_denied);
512
512
for (const auto & entry : dir_it) {
513
513
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) {
517
517
dl_handle_ptr handle { dl_load_library (entry) };
518
518
if (!handle && !silent) {
519
519
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,
544
544
// try to load the base backend
545
545
for (const auto & search_path : search_paths) {
546
546
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;
548
548
if (fs::exists (path)) {
549
549
return get_reg ().load_backend (path, silent);
550
550
}
0 commit comments