Merge pull request #8732 from Chocobo1/rename

Fix renaming completed files
This commit is contained in:
Mike Tzou 2018-04-15 00:39:00 +08:00 committed by GitHub
commit 7e8c72f424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -712,7 +712,10 @@ void PropertiesWidget::renameSelectedFile()
newName.chop(QB_EXT.size());
const QString oldFileName = m_torrent->fileName(fileIndex);
const QString oldFilePath = m_torrent->filePath(fileIndex);
const QString newFileName = newName + (BitTorrent::Session::instance()->isAppendExtensionEnabled() ? QB_EXT : QString());
const bool useFilenameExt = BitTorrent::Session::instance()->isAppendExtensionEnabled()
&& (m_torrent->filesProgress()[fileIndex] != 1);
const QString newFileName = newName + (useFilenameExt ? QB_EXT : QString());
const QString newFilePath = oldFilePath.leftRef(oldFilePath.size() - oldFileName.size()) + newFileName;
if (oldFileName == newFileName) {