Catch exceptions inside loop to continue listing files if there is an exception thrown for one or more files
This commit is contained in:
@@ -564,7 +564,12 @@ std::vector<Glib::ustring> FileCatalog::getFileList ()
|
|||||||
|
|
||||||
auto enumerator = dir->enumerate_children ("standard::name");
|
auto enumerator = dir->enumerate_children ("standard::name");
|
||||||
|
|
||||||
while (auto file = enumerator->next_file ()) {
|
while (true) {
|
||||||
|
try {
|
||||||
|
auto file = enumerator->next_file ();
|
||||||
|
if (!file) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
const Glib::ustring fname = file->get_name ();
|
const Glib::ustring fname = file->get_name ();
|
||||||
|
|
||||||
@@ -579,6 +584,11 @@ std::vector<Glib::ustring> FileCatalog::getFileList ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
names.emplace_back (Glib::build_filename (selectedDirectory, fname));
|
names.emplace_back (Glib::build_filename (selectedDirectory, fname));
|
||||||
|
} catch (Glib::Exception& exception) {
|
||||||
|
if (options.rtSettings.verbose) {
|
||||||
|
std::cerr << exception.what () << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Glib::Exception& exception) {
|
} catch (Glib::Exception& exception) {
|
||||||
|
Reference in New Issue
Block a user