From a01020cf227c157dbeaf9c74361c5eed834e9d96 Mon Sep 17 00:00:00 2001 From: tby Date: Wed, 2 Apr 2025 17:05:59 +0800 Subject: [PATCH] Fix: Abnormal exit on Android devices due to file access permission issues --- ggml/src/ggml-backend-reg.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ggml/src/ggml-backend-reg.cpp b/ggml/src/ggml-backend-reg.cpp index 405d8e3151..79b8be6109 100644 --- a/ggml/src/ggml-backend-reg.cpp +++ b/ggml/src/ggml-backend-reg.cpp @@ -510,7 +510,8 @@ 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()) { + std::error_code ec; + if (entry.is_regular_file(ec)) { auto filename = entry.path().filename(); auto ext = entry.path().extension(); if (filename.native().find(file_prefix) == 0 && ext == file_extension) {