Don't throw exceptions in list files util
This commit is contained in:
parent
de360a52b4
commit
8372d34c3d
@ -194,18 +194,19 @@ namespace utils::io
|
|||||||
|
|
||||||
std::vector<std::filesystem::path> list_files(const std::filesystem::path& directory, const bool recursive)
|
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;
|
std::vector<std::filesystem::path> files;
|
||||||
|
|
||||||
if (recursive)
|
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());
|
files.push_back(file.path());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (auto& file : std::filesystem::directory_iterator(directory))
|
for (auto& file : std::filesystem::directory_iterator(directory, code))
|
||||||
{
|
{
|
||||||
files.push_back(file.path());
|
files.push_back(file.path());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user