From e359202aa1553a9290f931fab562d7dd2e166cfa Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sat, 23 Jun 2012 11:53:02 +0200 Subject: 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 --- rbutil/rbutilqt/base/bootloaderinstallbase.cpp | 29 +++++++++++++++----------- 1 file 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) // strip any path, we don't know the structure in the zip QString f = QFileInfo(blfile.at(i)).fileName(); qDebug() << "[BootloaderInstallBase] searching archive for" << f; - int index = contents.indexOf(f); // FIXME: support files in folders - if(index >= 0) { - found = true; - emit logItem(tr("Extracting firmware %1 from archive") - .arg(f), LOGINFO); - // store in class temporary file - m_tempof.open(); - m_offile = m_tempof.fileName(); - m_tempof.close(); - if(!z.extractArchive(m_offile, contents.at(index))) { - emit logItem(tr("Error extracting firmware from archive"), LOGERROR); - found = false; + // contents.indexOf() works case sensitive. Since the filename + // casing is unknown (and might change) do this manually. + // FIXME: support files in folders + for(int j = 0; j < contents.size(); ++j) { + if(contents.at(j).compare(f, Qt::CaseInsensitive) == 0) { + found = true; + emit logItem(tr("Extracting firmware %1 from archive") + .arg(f), LOGINFO); + // store in class temporary file + m_tempof.open(); + m_offile = m_tempof.fileName(); + m_tempof.close(); + if(!z.extractArchive(m_offile, contents.at(j))) { + emit logItem(tr("Error extracting firmware from archive"), LOGERROR); + found = false; + break; + } break; } } -- cgit v1.2.3