diff options
| author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-03-11 18:57:11 +0100 |
|---|---|---|
| committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2013-11-04 23:00:23 +0100 |
| commit | 6375c47f036a4992ecb4bc3023a0fedbdc2356e0 (patch) | |
| tree | e882032544d8e6adcc8ecd19d69ba69aa0e11512 /rbutil/rbutilqt/base/bootloaderinstallbase.cpp | |
| parent | 289acf3333cf76ffc689aff8a17340b299ce0686 (diff) | |
| download | rockbox-6375c47f036a4992ecb4bc3023a0fedbdc2356e0.zip rockbox-6375c47f036a4992ecb4bc3023a0fedbdc2356e0.tar.gz rockbox-6375c47f036a4992ecb4bc3023a0fedbdc2356e0.tar.bz2 rockbox-6375c47f036a4992ecb4bc3023a0fedbdc2356e0.tar.xz | |
Add support for CAB archives to rbutil
Change-Id: Ia8b4953343caf8bc2b3c5a6cfd53c921c6d082b1
Reviewed-on: http://gerrit.rockbox.org/418
Reviewed-by: Dominik Riebeling <Dominik.Riebeling@gmail.com>
Diffstat (limited to 'rbutil/rbutilqt/base/bootloaderinstallbase.cpp')
| -rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallbase.cpp | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp index 6cfb2cd..1a47f96 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp @@ -22,6 +22,7 @@ #include "bootloaderinstallbase.h" #include "utils.h" #include "ziputil.h" +#include "mspackutil.h" #if defined(Q_OS_MACX) #include <sys/param.h> @@ -215,11 +216,34 @@ void BootloaderInstallBase::setBlFile(QStringList sl) bool BootloaderInstallBase::setOfFile(QString of, QStringList blfile) { bool found = false; - ZipUtil z(this); - // check if the file set is in zip format - if(z.open(of)) { + ArchiveUtil *util = 0; + + // try ZIP first + ZipUtil *zu = new ZipUtil(this); + if(zu->open(of)) + { emit logItem(tr("Zip file format detected"), LOGINFO); - QStringList contents = z.files(); + util = zu; + } + else + delete zu; + + // if ZIP failed, try CAB + if(util == 0) + { + MsPackUtil *msu = new MsPackUtil(this); + if(msu->open(of)) + { + emit logItem(tr("CAB file format detected"), LOGINFO); + util = msu; + } + else + delete msu; + } + + // check if the file set is in zip format + if(util) { + QStringList contents = util->files(); qDebug() << "[BootloaderInstallBase] archive contains:" << contents; for(int i = 0; i < blfile.size(); ++i) { // strip any path, we don't know the structure in the zip @@ -237,7 +261,7 @@ bool BootloaderInstallBase::setOfFile(QString of, QStringList blfile) m_tempof.open(); m_offile = m_tempof.fileName(); m_tempof.close(); - if(!z.extractArchive(m_offile, contents.at(j))) { + if(!util->extractArchive(m_offile, contents.at(j))) { emit logItem(tr("Error extracting firmware from archive"), LOGERROR); found = false; break; @@ -249,12 +273,13 @@ bool BootloaderInstallBase::setOfFile(QString of, QStringList blfile) if(!found) { emit logItem(tr("Could not find firmware in archive"), LOGERROR); } - + delete util; } else { m_offile = of; found = true; } + return found; } |