Use non-throwing directory_iterator

This commit is contained in:
Ilya Fedin 2023-08-26 00:53:51 +04:00 committed by John Preston
parent a479fcd55c
commit 77c2e12ebc
1 changed files with 3 additions and 6 deletions

View File

@ -45,12 +45,9 @@ inline QString IconName() {
inline bool CanReadDirectory(const QString &path) {
#ifndef Q_OS_MAC // directory_iterator since 10.15
try {
std::filesystem::directory_iterator(path.toStdString());
return true;
} catch (...) {
return false;
}
std::error_code error;
std::filesystem::directory_iterator(path.toStdString(), error);
return !error;
#else
Unexpected("Not implemented.");
#endif