summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-04-26 21:17:00 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-04-26 21:19:56 +0200
commitb623b97d4084f1dc0d92da8d932833004e331982 (patch)
treefe5fdafd68ad3c7508f41285993548de783cbe9c
parent07798ae5266d1384330d66c24ff8743d90b29340 (diff)
downloadrockbox-b623b97d4084f1dc0d92da8d932833004e331982.tar.gz
rockbox-b623b97d4084f1dc0d92da8d932833004e331982.zip
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
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallfile.cpp19
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)
80 80
81 // place (new) bootloader 81 // place (new) bootloader
82 m_tempfile.open(); 82 m_tempfile.open();
83 qDebug() << "[BootloaderInstallFile] renaming" << m_tempfile.fileName() << "to" << fwfile; 83 qDebug() << "[BootloaderInstallFile] renaming" << m_tempfile.fileName()
84 << "to" << fwfile;
84 m_tempfile.close(); 85 m_tempfile.close();
85 m_tempfile.copy(fwfile);
86 86
87 emit logItem(tr("Bootloader successful installed"), LOGOK); 87 if(!Utils::resolvePathCase(fwfile).isEmpty()) {
88 emit logItem(tr("A firmware file is already present on player"), LOGERROR);
89 emit done(true);
90 return;
91 }
92 if(m_tempfile.copy(fwfile)) {
93 emit logItem(tr("Bootloader successful installed"), LOGOK);
94 }
95 else {
96 emit logItem(tr("Copying modified firmware file failed"), LOGERROR);
97 emit done(true);
98 return;
99 }
100
88 logInstall(LogAdd); 101 logInstall(LogAdd);
89 102
90 emit done(false); 103 emit done(false);