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
This commit is contained in:
Dominik Riebeling 2012-04-10 20:33:15 +02:00
parent 2406005d8f
commit debe77a567

View file

@ -19,6 +19,7 @@
#include <QtCore> #include <QtCore>
#include "bootloaderinstallbase.h" #include "bootloaderinstallbase.h"
#include "bootloaderinstallhex.h" #include "bootloaderinstallhex.h"
#include "utils.h"
#include "../../tools/iriver.h" #include "../../tools/iriver.h"
#include "../../tools/mkboot.h" #include "../../tools/mkboot.h"
@ -209,9 +210,20 @@ void BootloaderInstallHex::installStage2(void)
return; return;
} }
// finally copy file to player // 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); emit logItem(tr("Success: modified firmware file created"), LOGINFO);
}
else {
emit logItem(tr("Copying modified firmware file failed"), LOGERROR);
emit done(true);
return;
}
logInstall(LogAdd); logInstall(LogAdd);
emit done(false); emit done(false);