mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 21:28:07 -06:00
Merge pull request #13995 from glassez/rename-files
Improve content file/folder names handling
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user