From debe77a567cc630f7e72388a965d5db0bbfd53d4 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Tue, 10 Apr 2012 20:33:15 +0200 Subject: [PATCH] Check for existing firmware file on H100 / H300. Show an error if copying the firmware file to the player failed. Also, check if there is already a firmware file present on the player. If so abort and tell the user about it, since QFile::copy() doesn't overwrite existing files and the user might not expect the file to get overwritten. Change-Id: Ie63963289965900a4ab519ddf128246f89d81c6c --- rbutil/rbutilqt/base/bootloaderinstallhex.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/rbutil/rbutilqt/base/bootloaderinstallhex.cpp b/rbutil/rbutilqt/base/bootloaderinstallhex.cpp index 3ff9c70936..3fdfba6c8a 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallhex.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallhex.cpp @@ -19,6 +19,7 @@ #include #include "bootloaderinstallbase.h" #include "bootloaderinstallhex.h" +#include "utils.h" #include "../../tools/iriver.h" #include "../../tools/mkboot.h" @@ -209,9 +210,20 @@ void BootloaderInstallHex::installStage2(void) return; } // finally copy file to player - targethex.copy(m_blfile); + if(!Utils::resolvePathCase(m_blfile).isEmpty()) { + emit logItem(tr("A firmware file is already present on player"), LOGERROR); + emit done(true); + return; + } + if(targethex.copy(m_blfile)) { + emit logItem(tr("Success: modified firmware file created"), LOGINFO); + } + else { + emit logItem(tr("Copying modified firmware file failed"), LOGERROR); + emit done(true); + return; + } - emit logItem(tr("Success: modified firmware file created"), LOGINFO); logInstall(LogAdd); emit done(false);