forked from len0rd/rockbox
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
This commit is contained in:
parent
83d210493d
commit
e359202aa1
1 changed files with 17 additions and 12 deletions
|
|
@ -225,18 +225,23 @@ bool BootloaderInstallBase::setOfFile(QString of, QStringList blfile)
|
||||||
// strip any path, we don't know the structure in the zip
|
// strip any path, we don't know the structure in the zip
|
||||||
QString f = QFileInfo(blfile.at(i)).fileName();
|
QString f = QFileInfo(blfile.at(i)).fileName();
|
||||||
qDebug() << "[BootloaderInstallBase] searching archive for" << f;
|
qDebug() << "[BootloaderInstallBase] searching archive for" << f;
|
||||||
int index = contents.indexOf(f); // FIXME: support files in folders
|
// contents.indexOf() works case sensitive. Since the filename
|
||||||
if(index >= 0) {
|
// casing is unknown (and might change) do this manually.
|
||||||
found = true;
|
// FIXME: support files in folders
|
||||||
emit logItem(tr("Extracting firmware %1 from archive")
|
for(int j = 0; j < contents.size(); ++j) {
|
||||||
.arg(f), LOGINFO);
|
if(contents.at(j).compare(f, Qt::CaseInsensitive) == 0) {
|
||||||
// store in class temporary file
|
found = true;
|
||||||
m_tempof.open();
|
emit logItem(tr("Extracting firmware %1 from archive")
|
||||||
m_offile = m_tempof.fileName();
|
.arg(f), LOGINFO);
|
||||||
m_tempof.close();
|
// store in class temporary file
|
||||||
if(!z.extractArchive(m_offile, contents.at(index))) {
|
m_tempof.open();
|
||||||
emit logItem(tr("Error extracting firmware from archive"), LOGERROR);
|
m_offile = m_tempof.fileName();
|
||||||
found = false;
|
m_tempof.close();
|
||||||
|
if(!z.extractArchive(m_offile, contents.at(j))) {
|
||||||
|
emit logItem(tr("Error extracting firmware from archive"), LOGERROR);
|
||||||
|
found = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue