Index: src/libchengine/TFilesystemFileFeedbackWrapper.cpp =================================================================== diff -u -N -r08717141ce5f6926116c298cbc9442094a45bb67 -rb9453afbc6264bc3f3c6a7f86fadab7744e0fb16 --- src/libchengine/TFilesystemFileFeedbackWrapper.cpp (.../TFilesystemFileFeedbackWrapper.cpp) (revision 08717141ce5f6926116c298cbc9442094a45bb67) +++ src/libchengine/TFilesystemFileFeedbackWrapper.cpp (.../TFilesystemFileFeedbackWrapper.cpp) (revision b9453afbc6264bc3f3c6a7f86fadab7744e0fb16) @@ -46,16 +46,24 @@ throw TCoreException(eErr_InvalidArgument, L"spFilesystem is NULL", LOCATION); } - TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::HandleFileAlreadyExistsFB(const TFileInfoPtr& spSrcFileInfo, bool& bShouldAppend) + TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::HandleFileAlreadyExistsFB(const TFileInfoPtr& spSrcFileInfo, const TDestinationPathProvider& rDstPathProvider, bool& bShouldAppend, bool& bShouldRename) { bShouldAppend = false; + bShouldRename = false; // read info about the existing destination file, TFileInfo tDstFileInfo; m_spFile->GetFileInfo(tDstFileInfo); + // calculate suggested destination filename + TSmartPath pathOriginalPlannedDestination = tDstFileInfo.GetFullFilePath(); + pathOriginalPlannedDestination.DeleteFileName(); + pathOriginalPlannedDestination += spSrcFileInfo->GetFullFilePath().GetFileName(); + + TSmartPath suggestedPath = rDstPathProvider.CalculateSuggestedDestinationPath(pathOriginalPlannedDestination); + // src and dst files are the same - TFeedbackResult frResult = m_spFeedbackManager->FileAlreadyExists(*spSrcFileInfo, tDstFileInfo); + TFeedbackResult frResult = m_spFeedbackManager->FileAlreadyExists(spSrcFileInfo, tDstFileInfo, suggestedPath); switch(frResult.GetResult()) { case eResult_Overwrite: @@ -81,6 +89,10 @@ case eResult_Pause: return TSubTaskBase::eSubResult_PauseRequest; + case eResult_Rename: + bShouldRename = true; + return TSubTaskBase::eSubResult_Continue; + default: BOOST_ASSERT(FALSE); // unknown result throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION);