diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-06-23 11:53:02 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-06-23 12:10:56 +0200 |
commit | e359202aa1553a9290f931fab562d7dd2e166cfa (patch) | |
tree | 79230c70021836e4b6dfe9f3020734be106842b8 | |
parent | 83d210493db8dd16f8724249b5b6a93c675c7c05 (diff) | |
download | rockbox-e359202aa1553a9290f931fab562d7dd2e166cfa.tar.gz rockbox-e359202aa1553a9290f931fab562d7dd2e166cfa.zip |
Fix bootloader zip extraction filename case sensitivity.
When searching for the bootloader file in a zip archive the filename in the
archive might use a different casing than the one we're looking after. Make the
search case-insensitive to not fail to find the file in this case.
Change-Id: I05ffc67421e67fae045eabb7851cd99a3757b6d7
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallbase.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp index 72c7526241..7a9258accc 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp | |||
@@ -225,18 +225,23 @@ bool BootloaderInstallBase::setOfFile(QString of, QStringList blfile) | |||
225 | // strip any path, we don't know the structure in the zip | 225 | // strip any path, we don't know the structure in the zip |
226 | QString f = QFileInfo(blfile.at(i)).fileName(); | 226 | QString f = QFileInfo(blfile.at(i)).fileName(); |
227 | qDebug() << "[BootloaderInstallBase] searching archive for" << f; | 227 | qDebug() << "[BootloaderInstallBase] searching archive for" << f; |
228 | int index = contents.indexOf(f); // FIXME: support files in folders | 228 | // contents.indexOf() works case sensitive. Since the filename |
229 | if(index >= 0) { | 229 | // casing is unknown (and might change) do this manually. |
230 | found = true; | 230 | // FIXME: support files in folders |
231 | emit logItem(tr("Extracting firmware %1 from archive") | 231 | for(int j = 0; j < contents.size(); ++j) { |
232 | .arg(f), LOGINFO); | 232 | if(contents.at(j).compare(f, Qt::CaseInsensitive) == 0) { |
233 | // store in class temporary file | 233 | found = true; |
234 | m_tempof.open(); | 234 | emit logItem(tr("Extracting firmware %1 from archive") |
235 | m_offile = m_tempof.fileName(); | 235 | .arg(f), LOGINFO); |
236 | m_tempof.close(); | 236 | // store in class temporary file |
237 | if(!z.extractArchive(m_offile, contents.at(index))) { | 237 | m_tempof.open(); |
238 | emit logItem(tr("Error extracting firmware from archive"), LOGERROR); | 238 | m_offile = m_tempof.fileName(); |
239 | found = false; | 239 | m_tempof.close(); |
240 | if(!z.extractArchive(m_offile, contents.at(j))) { | ||
241 | emit logItem(tr("Error extracting firmware from archive"), LOGERROR); | ||
242 | found = false; | ||
243 | break; | ||
244 | } | ||
240 | break; | 245 | break; |
241 | } | 246 | } |
242 | } | 247 | } |