Only sort those CLUT file names which are actually regular files.

This commit is contained in:
Adam Reichold
2016-01-11 22:55:04 +01:00
parent cc585058ab
commit 93d497573a

View File

@@ -230,7 +230,14 @@ int ClutComboBox::parseDir (const Glib::ustring& path)
try { try {
for (const auto& entry : Glib::Dir (path)) { for (const auto& entry : Glib::Dir (path)) {
entries.push_back (entry);
const auto entryPath = Glib::build_filename (path, entry);
if (!Glib::file_test (entryPath, Glib::FILE_TEST_IS_REGULAR)) {
continue;
}
entries.push_back (entryPath);
} }
} catch (Glib::Exception&) {} } catch (Glib::Exception&) {}
@@ -238,12 +245,6 @@ int ClutComboBox::parseDir (const Glib::ustring& path)
for (const auto& entry : entries) { for (const auto& entry : entries) {
const auto entryPath = Glib::build_filename (path, entry);
if (!Glib::file_test (entryPath, Glib::FILE_TEST_IS_REGULAR)) {
continue;
}
Glib::ustring name, extension, profileName; Glib::ustring name, extension, profileName;
splitClutFilename (entry, name, extension, profileName); splitClutFilename (entry, name, extension, profileName);
@@ -254,7 +255,7 @@ int ClutComboBox::parseDir (const Glib::ustring& path)
auto newRow = row ? *m_model->append (row.children ()) : *m_model->append (); auto newRow = row ? *m_model->append (row.children ()) : *m_model->append ();
newRow[m_columns.label] = name; newRow[m_columns.label] = name;
newRow[m_columns.clutFilename] = entryPath; newRow[m_columns.clutFilename] = entry;
if (++fileCount > maxFileCount) { if (++fileCount > maxFileCount) {
m_model->clear (); m_model->clear ();