23QFileSystemIterator::QFileSystemIterator(
const QFileSystemEntry &entry)
24 : dirPath(entry.filePath()),
25 toUtf16(QStringDecoder::Utf8)
27 dir.reset(QT_OPENDIR(entry.nativeFilePath().constData()));
31 if (!dirPath.endsWith(u'/'))
47bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaData &metaData)
49 auto asFileEntry = [
this](QStringView name) {
52 QString normalized = name.toString().normalized(QString::NormalizationForm_C);
55 return QFileSystemEntry(dirPath + name, QFileSystemEntry::FromInternalPath());
67 dirEntry = QT_READDIR(dir.get());
75 QByteArrayView name(dirEntry->d_name, strlen(dirEntry->d_name));
77 QVarLengthArray<
char16_t> buffer(name.size());
78 auto *end = toUtf16.appendToBuffer(buffer.data(), name);
79 buffer.resize(end - buffer.constData());
80 if (!toUtf16.hasError()) {
81 fileEntry = asFileEntry(buffer);
82 metaData.fillFromDirEnt(*dirEntry);