Index: sources/device/DeviceController.cpp =================================================================== diff -u -r026721c53d9c1fe9bbf99ce184afdb6610553d1f -r57556232c024a703ab87644901c4d65e7d18d1cc --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 026721c53d9c1fe9bbf99ce184afdb6610553d1f) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 57556232c024a703ab87644901c4d65e7d18d1cc) @@ -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 -r2ff5c29049307261cbee39176631155e11722914 -r57556232c024a703ab87644901c4d65e7d18d1cc --- sources/device/DeviceController.h (.../DeviceController.h) (revision 2ff5c29049307261cbee39176631155e11722914) +++ sources/device/DeviceController.h (.../DeviceController.h) (revision 57556232c024a703ab87644901c4d65e7d18d1cc) @@ -284,6 +284,9 @@ bool logBackup(const QString &vFileName); bool logUpload(const QString &vFileName); + bool logDuplicate(const QString &vFileName); + + signals: /*! * \brief didScreenshot