Android: Don't recurse into directories inside the assets when iterating
When iterating, it should only return what is in the specified path and not the contents of the sub-directories inside the given path in addition. Change-Id: Iad56f075c22fdf1c633582e37444e26520c24a73 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
parent
09c5dfb732
commit
eaf7f572bf
@ -202,9 +202,7 @@ public:
|
|||||||
const QString &path)
|
const QString &path)
|
||||||
: QAbstractFileEngineIterator(filters, nameFilters)
|
: QAbstractFileEngineIterator(filters, nameFilters)
|
||||||
{
|
{
|
||||||
m_stack.push_back(FolderIterator::fromCache(cleanedAssetPath(path), true));
|
m_currentIterator = FolderIterator::fromCache(cleanedAssetPath(path), true);
|
||||||
if (m_stack.last()->empty())
|
|
||||||
m_stack.pop_back();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo currentFileInfo() const override
|
QFileInfo currentFileInfo() const override
|
||||||
@ -228,36 +226,23 @@ public:
|
|||||||
|
|
||||||
bool hasNext() const override
|
bool hasNext() const override
|
||||||
{
|
{
|
||||||
if (m_stack.empty())
|
if (!m_currentIterator)
|
||||||
return false;
|
return false;
|
||||||
if (!m_stack.last()->hasNext()) {
|
return m_currentIterator->hasNext();
|
||||||
m_stack.pop_back();
|
|
||||||
return hasNext();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString next() override
|
QString next() override
|
||||||
{
|
{
|
||||||
if (m_stack.empty()) {
|
if (!m_currentIterator)
|
||||||
m_currentIterator.reset();
|
|
||||||
return {};
|
return {};
|
||||||
}
|
|
||||||
m_currentIterator = m_stack.last();
|
|
||||||
auto res = m_currentIterator->next();
|
auto res = m_currentIterator->next();
|
||||||
if (!res)
|
if (!res)
|
||||||
return {};
|
return {};
|
||||||
if (res->second.type == AssetItem::Type::Folder) {
|
|
||||||
m_stack.push_back(FolderIterator::fromCache(cleanedAssetPath(currentFilePath()), true));
|
|
||||||
if (m_stack.last()->empty())
|
|
||||||
m_stack.pop_back();
|
|
||||||
}
|
|
||||||
return res->first;
|
return res->first;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable QSharedPointer<FolderIterator> m_currentIterator;
|
QSharedPointer<FolderIterator> m_currentIterator;
|
||||||
mutable QVector<QSharedPointer<FolderIterator>> m_stack;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AndroidAbstractFileEngine: public QAbstractFileEngine
|
class AndroidAbstractFileEngine: public QAbstractFileEngine
|
||||||
|
Loading…
x
Reference in New Issue
Block a user