mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-11-03 09:22:01 +00:00 
			
		
		
		
	ggml-backend : fix backend search path (#12330)
* Fix backend search path * replace .native() with '/' * reverted .native()
This commit is contained in:
		@@ -497,7 +497,7 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
 | 
			
		||||
        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;
 | 
			
		||||
@@ -511,9 +511,9 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
 | 
			
		||||
        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());
 | 
			
		||||
@@ -544,7 +544,7 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
 | 
			
		||||
        // 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);
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user