mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-10 05:32:40 -05:00
rbutil: Move bootloader file check to base class.
Avoid constructing the bootloader file path in the caller. Pass filename list and mountpoint separately so it can directly fall back to the mountpoint. Change some functions to use references instead of creating temporary objects. Change-Id: I09c9d755553a32de3d02a42a8ce1fcb94f831b2a
This commit is contained in:
parent
1af92e5ff8
commit
8c55ce62b9
4 changed files with 24 additions and 36 deletions
|
|
@ -203,21 +203,28 @@ void BootloaderInstallBase::checkRemount()
|
||||||
|
|
||||||
//! @brief set list of possible bootloader files and pick the existing one.
|
//! @brief set list of possible bootloader files and pick the existing one.
|
||||||
//! @param sl list of possible bootloader files.
|
//! @param sl list of possible bootloader files.
|
||||||
void BootloaderInstallBase::setBlFile(QStringList sl)
|
void BootloaderInstallBase::setBlFile(const QString& mountpoint, const QStringList& sl)
|
||||||
{
|
{
|
||||||
// figue which of the possible bootloader filenames is correct.
|
if(sl.size() == 0) {
|
||||||
|
m_blfile = mountpoint;
|
||||||
|
}
|
||||||
|
else {
|
||||||
for(int a = 0; a < sl.size(); a++) {
|
for(int a = 0; a < sl.size(); a++) {
|
||||||
if(!Utils::resolvePathCase(sl.at(a)).isEmpty()) {
|
QString filename = mountpoint + sl.at(a);
|
||||||
m_blfile = sl.at(a);
|
if(!Utils::resolvePathCase(filename).isEmpty()) {
|
||||||
|
m_blfile = filename;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// figue which of the possible bootloader filenames is correct.
|
||||||
if(m_blfile.isEmpty() && sl.size() > 0) {
|
if(m_blfile.isEmpty() && sl.size() > 0) {
|
||||||
m_blfile = sl.at(0);
|
m_blfile = mountpoint + sl.at(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BootloaderInstallBase::setOfFile(QString of, QStringList blfile)
|
bool BootloaderInstallBase::setOfFile(QString& of, const QStringList& blfile)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
ArchiveUtil *util = nullptr;
|
ArchiveUtil *util = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -55,17 +55,17 @@ class BootloaderInstallBase : public QObject
|
||||||
bool backup(QString to);
|
bool backup(QString to);
|
||||||
|
|
||||||
//! set the different filenames and paths
|
//! set the different filenames and paths
|
||||||
void setBlFile(QStringList f);
|
void setBlFile(const QString& mountpoint, const QStringList& f);
|
||||||
void setBlUrl(QUrl u)
|
void setBlUrl(QUrl u)
|
||||||
{ m_blurl = u; }
|
{ m_blurl = u; }
|
||||||
void setLogfile(QString f)
|
void setLogfile(const QString& f)
|
||||||
{ m_logfile = f; }
|
{ m_logfile = f; }
|
||||||
bool setOfFile(QString of, QStringList blfile);
|
bool setOfFile(QString& of, const QStringList& blfile);
|
||||||
|
|
||||||
//! returns a port Install Hint or empty if there is none
|
//! returns a port Install Hint or empty if there is none
|
||||||
//! static and in the base class, so the installer classes dont need to
|
//! static and in the base class, so the installer classes dont need to
|
||||||
// be modified for new targets
|
// be modified for new targets
|
||||||
static QString postinstallHints(QString model);
|
static QString postinstallHints(const QString& model);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void downloadBlFinish(QNetworkReply::NetworkError error);
|
void downloadBlFinish(QNetworkReply::NetworkError error);
|
||||||
|
|
|
||||||
|
|
@ -308,17 +308,7 @@ void SelectiveInstallWidget::installBootloader(void)
|
||||||
// set bootloader filename. Do this now as installed() needs it.
|
// set bootloader filename. Do this now as installed() needs it.
|
||||||
QStringList blfile = PlayerBuildInfo::instance()->value(
|
QStringList blfile = PlayerBuildInfo::instance()->value(
|
||||||
PlayerBuildInfo::BootloaderFile).toStringList();
|
PlayerBuildInfo::BootloaderFile).toStringList();
|
||||||
QStringList blfilepath;
|
bl->setBlFile(RbSettings::value(RbSettings::Mountpoint).toString(), blfile);
|
||||||
for(int a = 0; a < blfile.size(); a++) {
|
|
||||||
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()
|
|
||||||
+ blfile.at(a));
|
|
||||||
}
|
|
||||||
// on devices without a bootloader file we use the mointpoint. The
|
|
||||||
// installer will use that to determine the correct device.
|
|
||||||
if(blfile.isEmpty()) {
|
|
||||||
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString());
|
|
||||||
}
|
|
||||||
bl->setBlFile(blfilepath);
|
|
||||||
QUrl url(PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderUrl).toString()
|
QUrl url(PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderUrl).toString()
|
||||||
+ PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderName).toString());
|
+ PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderName).toString());
|
||||||
bl->setBlUrl(url);
|
bl->setBlUrl(url);
|
||||||
|
|
|
||||||
|
|
@ -507,18 +507,9 @@ void RbUtilQt::uninstallBootloader(void)
|
||||||
logger->setFinished();
|
logger->setFinished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QStringList blfile = PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderFile).toStringList();
|
QStringList blfile = PlayerBuildInfo::instance()->value(
|
||||||
QStringList blfilepath;
|
PlayerBuildInfo::BootloaderFile).toStringList();
|
||||||
for(int a = 0; a < blfile.size(); a++) {
|
bl->setBlFile(RbSettings::value(RbSettings::Mountpoint).toString(), blfile);
|
||||||
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()
|
|
||||||
+ blfile.at(a));
|
|
||||||
}
|
|
||||||
// on devices without a bootloader file we use the mointpoint. The
|
|
||||||
// installer will use that to determine the correct device.
|
|
||||||
if(blfile.isEmpty()) {
|
|
||||||
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString());
|
|
||||||
}
|
|
||||||
bl->setBlFile(blfilepath);
|
|
||||||
bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString()
|
bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString()
|
||||||
+ "/.rockbox/rbutil.log");
|
+ "/.rockbox/rbutil.log");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue