From 9db98bb864c969cdbffd7081e49994ca31cc3084 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Mon, 15 Mar 2010 21:21:04 +0000 Subject: [PATCH] Fix bootloader files vanishing after installation (FS#11086). QTemporaryFile creates temporary files, so they might get removed even if they are renamed. Copy the downloaded temporary file instead. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25208 a1c6a512-1295-4272-9138-f99709370657 --- rbutil/rbutilqt/base/bootloaderinstallfile.cpp | 2 +- rbutil/rbutilqt/base/bootloaderinstallmi4.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/rbutil/rbutilqt/base/bootloaderinstallfile.cpp b/rbutil/rbutilqt/base/bootloaderinstallfile.cpp index 0db39a5be3..2e7061036d 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallfile.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallfile.cpp @@ -84,7 +84,7 @@ void BootloaderInstallFile::installStage2(void) m_tempfile.open(); qDebug() << "[BootloaderInstallFile] renaming" << m_tempfile.fileName() << "to" << fwfile; m_tempfile.close(); - m_tempfile.rename(fwfile); + m_tempfile.copy(fwfile); emit logItem(tr("Bootloader successful installed"), LOGOK); logInstall(LogAdd); diff --git a/rbutil/rbutilqt/base/bootloaderinstallmi4.cpp b/rbutil/rbutilqt/base/bootloaderinstallmi4.cpp index 8ae872d5ab..936ad175c3 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallmi4.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallmi4.cpp @@ -61,7 +61,7 @@ void BootloaderInstallMi4::installStage2(void) m_tempfile.open(); qDebug() << "[BootloaderInstallMi4] renaming" << m_tempfile.fileName() << "to" << fwfile; m_tempfile.close(); - m_tempfile.rename(fwfile); + m_tempfile.copy(fwfile); emit logItem(tr("Bootloader successful installed"), LOGOK); logInstall(LogAdd); @@ -96,8 +96,7 @@ bool BootloaderInstallMi4::uninstall(void) QFile blfile(resolved); blfile.remove(); - QFile oldbl(resolvePathCase(original)); - oldbl.rename(m_blfile); + QFile::rename(resolvePathCase(original), m_blfile); emit logItem(tr("Rockbox bootloader successful removed"), LOGINFO); logInstall(LogRemove); emit done(false);