QAbstractFileEngineIterator: ensure m_path
ends with '/'
... when it's first assigned, instead of in currentFilePath(), muck like what QFileSystemIterator does. Change-Id: Id58ddcd6df5ad911fd5a62f1ca386e25626cb781 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
e9126fd3ab
commit
d89c32140a
@ -19,6 +19,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static QString appendSlashIfNeeded(const QString &path)
|
||||
{
|
||||
if (!path.isEmpty() && !path.endsWith(u'/'))
|
||||
return QString{path + u'/'};
|
||||
return path;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QAbstractFileEngineHandler
|
||||
\inmodule QtCore
|
||||
@ -919,7 +926,7 @@ QString QAbstractFileEngineIterator::path() const
|
||||
*/
|
||||
void QAbstractFileEngineIterator::setPath(const QString &path)
|
||||
{
|
||||
m_path = path;
|
||||
m_path = appendSlashIfNeeded(path);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -960,15 +967,10 @@ QDir::Filters QAbstractFileEngineIterator::filters() const
|
||||
QString QAbstractFileEngineIterator::currentFilePath() const
|
||||
{
|
||||
QString name = currentFileName();
|
||||
if (!name.isNull()) {
|
||||
QString tmp = path();
|
||||
if (!tmp.isEmpty()) {
|
||||
if (!tmp.endsWith(u'/'))
|
||||
tmp.append(u'/');
|
||||
name.prepend(tmp);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
if (name.isNull())
|
||||
return name;
|
||||
|
||||
return path() + name;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Loading…
x
Reference in New Issue
Block a user