From 8372d34c3dbd3b1e005472d2d7cc4337be36b497 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Thu, 13 Apr 2023 17:18:07 +0200 Subject: [PATCH] Don't throw exceptions in list files util --- src/common/utils/io.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/utils/io.cpp b/src/common/utils/io.cpp index e981315d..6efce973 100644 --- a/src/common/utils/io.cpp +++ b/src/common/utils/io.cpp @@ -194,18 +194,19 @@ namespace utils::io std::vector list_files(const std::filesystem::path& directory, const bool recursive) { + std::error_code code{}; std::vector files; if (recursive) { - for (auto& file : std::filesystem::recursive_directory_iterator(directory)) + for (auto& file : std::filesystem::recursive_directory_iterator(directory, code)) { files.push_back(file.path()); } } else { - for (auto& file : std::filesystem::directory_iterator(directory)) + for (auto& file : std::filesystem::directory_iterator(directory, code)) { files.push_back(file.path()); }