diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2022-04-16 14:13:59 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2022-04-17 23:21:19 +0200 |
commit | 8c55ce62b9e65533619870d1e5b72612a1a16406 (patch) | |
tree | a39beb02600048177920f3b888fed5b5f3fe66be /utils/rbutilqt/base/bootloaderinstallbase.cpp | |
parent | 1af92e5ff84bcb05d264d65d2904c4d9fe8f0d98 (diff) | |
download | rockbox-8c55ce62b9e65533619870d1e5b72612a1a16406.tar.gz rockbox-8c55ce62b9e65533619870d1e5b72612a1a16406.zip |
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
Diffstat (limited to 'utils/rbutilqt/base/bootloaderinstallbase.cpp')
-rw-r--r-- | utils/rbutilqt/base/bootloaderinstallbase.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/utils/rbutilqt/base/bootloaderinstallbase.cpp b/utils/rbutilqt/base/bootloaderinstallbase.cpp index 36a15c9e1a..b49a9b933b 100644 --- a/utils/rbutilqt/base/bootloaderinstallbase.cpp +++ b/utils/rbutilqt/base/bootloaderinstallbase.cpp | |||
@@ -203,21 +203,28 @@ void BootloaderInstallBase::checkRemount() | |||
203 | 203 | ||
204 | //! @brief set list of possible bootloader files and pick the existing one. | 204 | //! @brief set list of possible bootloader files and pick the existing one. |
205 | //! @param sl list of possible bootloader files. | 205 | //! @param sl list of possible bootloader files. |
206 | void BootloaderInstallBase::setBlFile(QStringList sl) | 206 | void BootloaderInstallBase::setBlFile(const QString& mountpoint, const QStringList& sl) |
207 | { | 207 | { |
208 | // figue which of the possible bootloader filenames is correct. | 208 | if(sl.size() == 0) { |
209 | for(int a = 0; a < sl.size(); a++) { | 209 | m_blfile = mountpoint; |
210 | if(!Utils::resolvePathCase(sl.at(a)).isEmpty()) { | ||
211 | m_blfile = sl.at(a); | ||
212 | } | ||
213 | } | 210 | } |
214 | if(m_blfile.isEmpty() && sl.size() > 0) { | 211 | else { |
215 | m_blfile = sl.at(0); | 212 | for(int a = 0; a < sl.size(); a++) { |
213 | QString filename = mountpoint + sl.at(a); | ||
214 | if(!Utils::resolvePathCase(filename).isEmpty()) { | ||
215 | m_blfile = filename; | ||
216 | break; | ||
217 | } | ||
218 | } | ||
219 | // figue which of the possible bootloader filenames is correct. | ||
220 | if(m_blfile.isEmpty() && sl.size() > 0) { | ||
221 | m_blfile = mountpoint + sl.at(0); | ||
222 | } | ||
216 | } | 223 | } |
217 | } | 224 | } |
218 | 225 | ||
219 | 226 | ||
220 | bool BootloaderInstallBase::setOfFile(QString of, QStringList blfile) | 227 | bool BootloaderInstallBase::setOfFile(QString& of, const QStringList& blfile) |
221 | { | 228 | { |
222 | bool found = false; | 229 | bool found = false; |
223 | ArchiveUtil *util = nullptr; | 230 | ArchiveUtil *util = nullptr; |