Index: sources/device/DeviceController.cpp =================================================================== diff -u -rc7a601b156691ad8c86e3fd177e966056bf6728a -r4fe1242233f0928c347f0e973dd5284b1c5583dd --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision c7a601b156691ad8c86e3fd177e966056bf6728a) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 4fe1242233f0928c347f0e973dd5284b1c5583dd) @@ -1055,6 +1055,41 @@ return ok; } +bool DeviceController::logDuplicate(const QString &vFileName) +{ + if ( ! gLogUpload ) return false; // no log Uploaded rename + + bool ok = true; + QFileInfo fileInfo(vFileName); + QString filePath; + QString fileDest; + QString fileBase(fileInfo.baseName()); + quint8 tally = 0; + + const QString pendingExt = _Logger.logFileNamePendingSubExt(); + const QString uploadExt = _Logger.logFileNameUploadedSubExt(); + + Logger::LogType logType = _Logger.logFileLogType(vFileName, filePath); + ok = logType != Logger::eLogNone; + if ( ! ok ) { LOG_APPED_UI(QString("CS Incorrect log upload type [%1]").arg(fileInfo.completeSuffix())); goto lOut; } + // DEBUG qDebug() << __FUNCTION__ << "\n" << vFileName << "\n" << fileDest; + + do { + QString subExt = (tally == 0) ? uploadExt : QString("c%1.").arg(tally); + + QString fileSufx = fileInfo.completeSuffix().replace(pendingExt, subExt); + + fileDest = QString("%1.%2").arg(fileBase, fileSufx); + ++tally; + + } while (QFile::exists(filePath + fileDest)); + + qDebug() << __FUNCTION__ << "\n" << vFileName << "\n" << fileDest; +// ok = QFile::rename(filePath + vFileName, filePath + fileDest); +lOut: + return ok; +} + void DeviceController::onLogUpload(const QString &vFileName, const quint32 &vAccepted, const quint32 &vRejectReason) { if ( ! gLogUpload ) return; // no log uploaded rename ( slot ) Index: sources/device/DeviceController.h =================================================================== diff -u -r2b999e7cb21620d4b43cefc0908e3367bd05c840 -r4fe1242233f0928c347f0e973dd5284b1c5583dd --- sources/device/DeviceController.h (.../DeviceController.h) (revision 2b999e7cb21620d4b43cefc0908e3367bd05c840) +++ sources/device/DeviceController.h (.../DeviceController.h) (revision 4fe1242233f0928c347f0e973dd5284b1c5583dd) @@ -284,6 +284,9 @@ bool logBackup(const QString &vFileName); bool logUpload(const QString &vFileName); + bool logDuplicate(const QString &vFileName); + + signals: /*! * \brief didScreenshot