Catch exceptions inside loop to continue listing files if there is an exception thrown for one or more files

This commit is contained in:
heckflosse
2018-06-21 19:19:25 +02:00
parent 2faa8ec4f1
commit 01d4ed3025

View File

@@ -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) {