From 9675e19b94ee6fda5f22f2fdd071a407297fb9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sat, 10 Feb 2018 09:57:21 +0100 Subject: [PATCH] Fixed error reporting --- src/map/maplist.cpp | 29 ++++++++++++++++------------- src/map/maplist.h | 1 + 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/map/maplist.cpp b/src/map/maplist.cpp index 04d46bfc..5cdae0be 100644 --- a/src/map/maplist.cpp +++ b/src/map/maplist.cpp @@ -78,16 +78,7 @@ bool MapList::loadFile(const QString &path, bool *atlas, bool dir) } } -bool MapList::loadFile(const QString &path) -{ - bool atlas; - - _errorString.clear(); - - return loadFile(path, &atlas, false); -} - -bool MapList::loadDir(const QString &path) +bool MapList::loadDirR(const QString &path) { QDir md(path); md.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); @@ -95,14 +86,12 @@ bool MapList::loadDir(const QString &path) QFileInfoList ml = md.entryInfoList(); bool atlas, ret = true; - _errorString.clear(); - for (int i = 0; i < ml.size(); i++) { const QFileInfo &fi = ml.at(i); QString suffix = fi.suffix().toLower(); if (fi.isDir() && fi.fileName() != "set") { - if (!loadDir(fi.absoluteFilePath())) + if (!loadDirR(fi.absoluteFilePath())) ret = false; } else if (filter().contains("*." + suffix)) { if (!loadFile(fi.absoluteFilePath(), &atlas, true)) @@ -115,6 +104,20 @@ bool MapList::loadDir(const QString &path) return ret; } +bool MapList::loadFile(const QString &path) +{ + bool atlas; + + _errorString.clear(); + return loadFile(path, &atlas, false); +} + +bool MapList::loadDir(const QString &path) +{ + _errorString.clear(); + return loadDirR(path); +} + void MapList::clear() { for (int i = 0; i < _maps.count(); i++) diff --git a/src/map/maplist.h b/src/map/maplist.h index a12d055a..93481320 100644 --- a/src/map/maplist.h +++ b/src/map/maplist.h @@ -26,6 +26,7 @@ public: private: bool loadFile(const QString &path, bool *atlas, bool dir); + bool loadDirR(const QString &path); Map *loadListEntry(const QByteArray &line);