Commit efd12724 authored by Stefan Brüns's avatar Stefan Brüns
Browse files

Filter out resource forks when filtering for images

The pages in a comic book are just a set of images, ordered by filename.
When there is a resource fork (as created by MacOS when using the
built-in ZIP support), the metadata files (which have the same suffix as
the corresponding image files) are sorted first.

For e.g a two page book the files `book_01.png`, `book_02.png` are sorted
after and hidden by `__MACOSX/._book_01.png`, `__MACOSX._book_02.png`.
parent ef76b22b
......@@ -97,6 +97,11 @@ void ComicCreator::filterImages(QStringList& entries)
/// Sort case-insensitive, then remove non-image entries.
QMap<QString, QString> entryMap;
for (const QString& entry : qAsConst(entries)) {
// Skip MacOS resource forks
if (entry.startsWith(QLatin1String("__MACOSX"), Qt::CaseInsensitive) ||
entry.startsWith(QLatin1String(".DS_Store"), Qt::CaseInsensitive)) {
if (entry.endsWith(QLatin1String(".gif"), Qt::CaseInsensitive) ||
entry.endsWith(QLatin1String(".jpg"), Qt::CaseInsensitive) ||
entry.endsWith(QLatin1String(".jpeg"), Qt::CaseInsensitive) ||
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment