Implement class for handling filesystem paths

PR #15915.
This commit is contained in:
Vladimir Golovnev 2022-02-08 06:03:48 +03:00 committed by GitHub
commit dd1bd8ad10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
131 changed files with 2252 additions and 1868 deletions

View file

@ -53,6 +53,7 @@
#include "base/bittorrent/abstractfilestorage.h"
#include "base/bittorrent/downloadpriority.h"
#include "base/global.h"
#include "base/path.h"
#include "base/utils/fs.h"
#include "torrentcontentmodelfile.h"
#include "torrentcontentmodelfolder.h"
@ -503,7 +504,7 @@ void TorrentContentModel::setupModelData(const BitTorrent::AbstractFileStorage &
for (int i = 0; i < filesCount; ++i)
{
currentParent = m_rootItem;
const QString path = Utils::Fs::toUniformPath(info.filePath(i));
const QString path = info.filePath(i).data();
// Iterate of parts of the path to create necessary folders
QList<QStringView> pathFolders = QStringView(path).split(u'/', Qt::SkipEmptyParts);
@ -523,7 +524,7 @@ void TorrentContentModel::setupModelData(const BitTorrent::AbstractFileStorage &
}
// Actually create the file
TorrentContentModelFile *fileItem = new TorrentContentModelFile(
Utils::Fs::fileName(info.filePath(i)), info.fileSize(i), currentParent, i);
info.filePath(i).filename(), info.fileSize(i), currentParent, i);
currentParent->appendChild(fileItem);
m_filesIndex.push_back(fileItem);
}