diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-04-26 21:17:00 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-04-26 21:19:56 +0200 |
commit | b623b97d4084f1dc0d92da8d932833004e331982 (patch) | |
tree | fe5fdafd68ad3c7508f41285993548de783cbe9c /rbutil/rbutilqt/base | |
parent | 07798ae5266d1384330d66c24ff8743d90b29340 (diff) |
Check for bootloader file on device before copying.
QFile::copy() doesn't overwrite an already existing file. This can lead to
bootloader installation trying to place a new file on the player but failing to
do the actual copy if the file already exists. Since overwriting an already
existing file might be unexpected by the user error out in this case and notify
the user.
Change-Id: I5ffaf2f1344271ea2bad9e3232234826552385ec
Diffstat (limited to 'rbutil/rbutilqt/base')
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallfile.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstallfile.cpp b/rbutil/rbutilqt/base/bootloaderinstallfile.cpp index 6d95106dd4..fc293e54eb 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallfile.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallfile.cpp @@ -80,11 +80,24 @@ void BootloaderInstallFile::installStage2(void) // place (new) bootloader m_tempfile.open(); - qDebug() << "[BootloaderInstallFile] renaming" << m_tempfile.fileName() << "to" << fwfile; + qDebug() << "[BootloaderInstallFile] renaming" << m_tempfile.fileName() + << "to" << fwfile; m_tempfile.close(); - m_tempfile.copy(fwfile); - emit logItem(tr("Bootloader successful installed"), LOGOK); + if(!Utils::resolvePathCase(fwfile).isEmpty()) { + emit logItem(tr("A firmware file is already present on player"), LOGERROR); + emit done(true); + return; + } + if(m_tempfile.copy(fwfile)) { + emit logItem(tr("Bootloader successful installed"), LOGOK); + } + else { + emit logItem(tr("Copying modified firmware file failed"), LOGERROR); + emit done(true); + return; + } + logInstall(LogAdd); emit done(false); |