Merge pull request #16444 from glassez/path-has-ext

Improve performance of checking path extension
This commit is contained in:
Vladimir Golovnev
2022-02-19 07:08:54 +03:00
committed by GitHub
5 changed files with 15 additions and 8 deletions

View File

@@ -209,7 +209,7 @@ void CustomDiskIOThread::handleCompleteFiles(lt::storage_index_t storage, const
{
const Path incompleteFilePath = savePath / filePath;
Path completeFilePath = incompleteFilePath;
completeFilePath.removeExtension();
completeFilePath.removeExtension(QB_EXT);
if (completeFilePath.exists())
{
Utils::Fs::removeFile(incompleteFilePath);

View File

@@ -294,8 +294,7 @@ TorrentImpl::TorrentImpl(Session *session, lt::session *nativeSession
m_indexMap[nativeIndex] = i;
Path filePath {fileStorage.file_path(nativeIndex)};
if (filePath.hasExtension(QB_EXT))
filePath.removeExtension();
filePath.removeExtension(QB_EXT);
m_filePaths.append(filePath);
const auto priority = LT::fromNative(filePriorities[LT::toUnderlyingType(nativeIndex)]);
@@ -1511,8 +1510,7 @@ void TorrentImpl::endReceivedMetadataHandling(const Path &savePath, const PathLi
Path filePath = fileNames.at(i);
p.renamed_files[nativeIndex] = filePath.toString().toStdString();
if (filePath.hasExtension(QB_EXT))
filePath.removeExtension();
filePath.removeExtension(QB_EXT);
m_filePaths.append(filePath);
const auto priority = LT::fromNative(filePriorities[LT::toUnderlyingType(nativeIndex)]);