Fix: Abnormal exit on Android devices due to file access permission issues

This commit is contained in:
tby 2025-04-02 17:05:59 +08:00
parent 42eb248f46
commit a01020cf22
1 changed files with 2 additions and 1 deletions

View File

@ -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) {