From 459d02abc8797a6ab1310ad5c0f871758ffdf7d6 Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Sat, 6 Feb 2021 11:33:46 +0300 Subject: [PATCH] Allow change-case-only file renaming on Windows --- src/base/bittorrent/abstractfilestorage.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/base/bittorrent/abstractfilestorage.cpp b/src/base/bittorrent/abstractfilestorage.cpp index c43aa7a1e..61f0f75d6 100644 --- a/src/base/bittorrent/abstractfilestorage.cpp +++ b/src/base/bittorrent/abstractfilestorage.cpp @@ -78,8 +78,7 @@ void BitTorrent::AbstractFileStorage::renameFile(const QString &oldPath, const Q if ((renamingFileIndex < 0) && areSameFileNames(path, oldFilePath)) renamingFileIndex = i; - - if (areSameFileNames(path, newFilePath)) + else if (areSameFileNames(path, newFilePath)) throw RuntimeError {tr("The file already exists: '%1'.").arg(newFilePath)}; } @@ -124,8 +123,7 @@ void BitTorrent::AbstractFileStorage::renameFolder(const QString &oldPath, const if (path.startsWith(oldFolderPath, CASE_SENSITIVITY)) renamingFileIndexes.append(i); - - if (path.startsWith(newFolderPath, CASE_SENSITIVITY)) + else if (path.startsWith(newFolderPath, CASE_SENSITIVITY)) throw RuntimeError {tr("The folder already exists: '%1'.").arg(newFolderPath)}; }