summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/bootloaderinstallbase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/base/bootloaderinstallbase.cpp')
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallbase.cpp37
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;
}