search_paths.push_back(get_executable_path());
search_paths.push_back(fs::current_path());
} else {
- search_paths.push_back(user_search_path);
+ search_paths.push_back(fs::u8path(user_search_path));
}
int best_score = 0;
fs::directory_iterator dir_it(search_path, fs::directory_options::skip_permission_denied);
for (const auto & entry : dir_it) {
if (entry.is_regular_file()) {
- auto filename = entry.path().filename().native();
- auto ext = entry.path().extension().native();
- if (filename.find(file_prefix) == 0 && ext == file_extension) {
+ auto filename = entry.path().filename();
+ auto ext = entry.path().extension();
+ if (filename.native().find(file_prefix) == 0 && ext == file_extension) {
dl_handle_ptr handle { dl_load_library(entry) };
if (!handle && !silent) {
GGML_LOG_ERROR("%s: failed to load %s\n", __func__, path_str(entry.path()).c_str());
// try to load the base backend
for (const auto & search_path : search_paths) {
fs::path filename = backend_filename_prefix().native() + name_path.native() + backend_filename_extension().native();
- fs::path path = search_path.native() + filename.native();
+ fs::path path = search_path / filename;
if (fs::exists(path)) {
return get_reg().load_backend(path, silent);
}