From 0d27117c95fb718d16dfdf9c69d287054cfab4f4 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Thu, 3 Dec 2020 16:23:03 +0800 Subject: [PATCH] Catch exception --- edxp-core/src/main/cpp/main/src/config_manager.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/edxp-core/src/main/cpp/main/src/config_manager.cpp b/edxp-core/src/main/cpp/main/src/config_manager.cpp index 49fd2e2f..1bd61ed0 100644 --- a/edxp-core/src/main/cpp/main/src/config_manager.cpp +++ b/edxp-core/src/main/cpp/main/src/config_manager.cpp @@ -109,10 +109,14 @@ namespace edxp { std::unordered_set ConfigManager::GetAppList(const fs::path &dir) { std::unordered_set set; - for (auto &item: fs::directory_iterator(dir)) { - if (item.is_regular_file()) { - set.emplace(item.path().filename()); + try { + for (auto &item: fs::directory_iterator(dir)) { + if (item.is_regular_file()) { + set.emplace(item.path().filename()); + } } + } catch (const fs::filesystem_error &e) { + LOGE("%s", e.what()); } return set; }