mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 14:38:04 -06:00
@@ -103,8 +103,8 @@ BitTorrent::BencodeResumeDataStorage::BencodeResumeDataStorage(const Path &path,
|
||||
.arg(m_resumeDataPath.toString()));
|
||||
}
|
||||
|
||||
const QRegularExpression filenamePattern {QLatin1String("^([A-Fa-f0-9]{40})\\.fastresume$")};
|
||||
const QStringList filenames = QDir(m_resumeDataPath.data()).entryList(QStringList(QLatin1String("*.fastresume")), QDir::Files, QDir::Unsorted);
|
||||
const QRegularExpression filenamePattern {u"^([A-Fa-f0-9]{40})\\.fastresume$"_qs};
|
||||
const QStringList filenames = QDir(m_resumeDataPath.data()).entryList(QStringList(u"*.fastresume"_qs), QDir::Files, QDir::Unsorted);
|
||||
|
||||
m_registeredTorrents.reserve(filenames.size());
|
||||
for (const QString &filename : filenames)
|
||||
@@ -137,8 +137,8 @@ QVector<BitTorrent::TorrentID> BitTorrent::BencodeResumeDataStorage::registeredT
|
||||
std::optional<BitTorrent::LoadTorrentParams> BitTorrent::BencodeResumeDataStorage::load(const TorrentID &id) const
|
||||
{
|
||||
const QString idString = id.toString();
|
||||
const Path fastresumePath = m_resumeDataPath / Path(idString + QLatin1String(".fastresume"));
|
||||
const Path torrentFilePath = m_resumeDataPath / Path(idString + QLatin1String(".torrent"));
|
||||
const Path fastresumePath = m_resumeDataPath / Path(idString + u".fastresume");
|
||||
const Path torrentFilePath = m_resumeDataPath / Path(idString + u".torrent");
|
||||
|
||||
QFile resumeDataFile {fastresumePath.data()};
|
||||
if (!resumeDataFile.open(QIODevice::ReadOnly))
|
||||
@@ -284,7 +284,7 @@ void BitTorrent::BencodeResumeDataStorage::loadQueue(const Path &queueFilename)
|
||||
|
||||
if (queueFile.open(QFile::ReadOnly))
|
||||
{
|
||||
const QRegularExpression hashPattern {QLatin1String("^([A-Fa-f0-9]{40})$")};
|
||||
const QRegularExpression hashPattern {u"^([A-Fa-f0-9]{40})$"_qs};
|
||||
QString line;
|
||||
int start = 0;
|
||||
while (!(line = QString::fromLatin1(queueFile.readLine().trimmed())).isEmpty())
|
||||
@@ -353,7 +353,7 @@ void BitTorrent::BencodeResumeDataStorage::Worker::store(const TorrentID &id, co
|
||||
metadataDict.insert(dataDict.extract("created by"));
|
||||
metadataDict.insert(dataDict.extract("comment"));
|
||||
|
||||
const Path torrentFilepath = m_resumeDataDir / Path(QString::fromLatin1("%1.torrent").arg(id.toString()));
|
||||
const Path torrentFilepath = m_resumeDataDir / Path(u"%1.torrent"_qs.arg(id.toString()));
|
||||
const nonstd::expected<void, QString> result = Utils::IO::saveToFile(torrentFilepath, metadata);
|
||||
if (!result)
|
||||
{
|
||||
@@ -378,7 +378,7 @@ void BitTorrent::BencodeResumeDataStorage::Worker::store(const TorrentID &id, co
|
||||
data["qBt-downloadPath"] = Profile::instance()->toPortablePath(resumeData.downloadPath).data().toStdString();
|
||||
}
|
||||
|
||||
const Path resumeFilepath = m_resumeDataDir / Path(QString::fromLatin1("%1.fastresume").arg(id.toString()));
|
||||
const Path resumeFilepath = m_resumeDataDir / Path(u"%1.fastresume"_qs.arg(id.toString()));
|
||||
const nonstd::expected<void, QString> result = Utils::IO::saveToFile(resumeFilepath, data);
|
||||
if (!result)
|
||||
{
|
||||
@@ -389,10 +389,10 @@ void BitTorrent::BencodeResumeDataStorage::Worker::store(const TorrentID &id, co
|
||||
|
||||
void BitTorrent::BencodeResumeDataStorage::Worker::remove(const TorrentID &id) const
|
||||
{
|
||||
const Path resumeFilename {QString::fromLatin1("%1.fastresume").arg(id.toString())};
|
||||
const Path resumeFilename {u"%1.fastresume"_qs.arg(id.toString())};
|
||||
Utils::Fs::removeFile(m_resumeDataDir / resumeFilename);
|
||||
|
||||
const Path torrentFilename {QString::fromLatin1("%1.torrent").arg(id.toString())};
|
||||
const Path torrentFilename {u"%1.torrent"_qs.arg(id.toString())};
|
||||
Utils::Fs::removeFile(m_resumeDataDir / torrentFilename);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user