Don't throw exceptions in list files util

This commit is contained in:
momo5502 2023-04-13 17:18:07 +02:00
parent de360a52b4
commit 8372d34c3d

View File

@ -194,18 +194,19 @@ namespace utils::io
std::vector<std::filesystem::path> list_files(const std::filesystem::path& directory, const bool recursive)
{
std::error_code code{};
std::vector<std::filesystem::path> 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());
}