Skip to content
Snippets Groups Projects
Commit edc60bb9 authored by Philippe Gorley's avatar Philippe Gorley Committed by Adrien Béraud
Browse files

file transfer: rename duplicate files

Add duplicate number after filename, but before extension, and start
count at 1 instead of 0.

Before, it would be '(0)file.jpg', now it is 'file (1).jpg'.

Change-Id: I0e1f74c172c3c4a66baca8b94302ddf9f42f35d1
parent 87a901cb
Branches
No related tags found
No related merge requests found
......@@ -1965,8 +1965,8 @@ ConversationModelPimpl::slotTransferStatusAwaitingHost(long long dringId, datatr
auto wantedFilename = destinationDir + info.displayName;
auto duplicate = 0;
while (std::ifstream(wantedFilename).good()) {
wantedFilename = destinationDir + "(" + std::to_string(duplicate) + ")" + info.displayName;
++duplicate;
wantedFilename = destinationDir + info.displayName.substr(0, extensionIdx) + " (" + std::to_string(duplicate) + ")" + extension;
}
acceptTransfer(convId, interactionId, wantedFilename);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment