Merge pull request #13995 from glassez/rename-files

Improve content file/folder names handling
This commit is contained in:
Vladimir Golovnev
2020-12-29 22:27:58 +03:00
committed by GitHub
18 changed files with 311 additions and 301 deletions

View File

@@ -1405,11 +1405,12 @@ void TorrentHandleImpl::moveStorage(const QString &newPath, const MoveStorageMod
}
}
void TorrentHandleImpl::renameFile(const int index, const QString &name)
void TorrentHandleImpl::renameFile(const int index, const QString &path)
{
m_oldPath[lt::file_index_t {index}].push_back(filePath(index));
const QString oldPath = filePath(index);
m_oldPath[lt::file_index_t {index}].push_back(oldPath);
++m_renameCount;
m_nativeHandle.rename_file(lt::file_index_t {index}, Utils::Fs::toNativePath(name).toStdString());
m_nativeHandle.rename_file(lt::file_index_t {index}, Utils::Fs::toNativePath(path).toStdString());
}
void TorrentHandleImpl::handleStateUpdate(const lt::torrent_status &nativeStatus)
@@ -1826,7 +1827,7 @@ void TorrentHandleImpl::manageIncompleteFiles()
QString name = filePath(i);
if (isAppendExtensionEnabled && (fileSize(i) > 0) && (fp[i] < 1))
{
if (!name.endsWith(QB_EXT))
if (!name.endsWith(QB_EXT, Qt::CaseInsensitive))
{
const QString newName = name + QB_EXT;
qDebug() << "Renaming" << name << "to" << newName;
@@ -1835,7 +1836,7 @@ void TorrentHandleImpl::manageIncompleteFiles()
}
else
{
if (name.endsWith(QB_EXT))
if (name.endsWith(QB_EXT, Qt::CaseInsensitive))
{
const QString oldName = name;
name.chop(QB_EXT.size());