mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-21 19:35:49 +08:00
bugfix: retrieve downloaded ipa file path from ipatool instead of searching
This commit is contained in:
+1
-1
Submodule lib/ipatool-go updated: d4f0f3448a...6573e7822c
+25
-22
@@ -18,6 +18,22 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "appinstalldialog.h"
|
#include "appinstalldialog.h"
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <cstdlib>
|
||||||
|
extern "C" {
|
||||||
|
char *IpaToolGetDownloadedFilePath(const char *bundleId);
|
||||||
|
}
|
||||||
|
static QString ipaPathFromIpatool(const QString &bundleId)
|
||||||
|
{
|
||||||
|
QByteArray utf8 = bundleId.toUtf8();
|
||||||
|
char *cPath = IpaToolGetDownloadedFilePath(utf8.constData());
|
||||||
|
if (!cPath) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
QString path = QString::fromUtf8(cPath);
|
||||||
|
std::free(cPath);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
AppInstallDialog::AppInstallDialog(const QString &appName,
|
AppInstallDialog::AppInstallDialog(const QString &appName,
|
||||||
const QString &description,
|
const QString &description,
|
||||||
@@ -246,41 +262,28 @@ void AppInstallDialog::onInstallClicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
startDownloadProcess(m_bundleId, m_tempDir->path(), buttonIndex, false,
|
startDownloadProcess(m_bundleId, m_tempDir->path(), buttonIndex, false,
|
||||||
false);
|
false, true);
|
||||||
|
|
||||||
// FIXME USE SAFETHIS
|
|
||||||
connect(
|
connect(
|
||||||
this, &AppDownloadBaseDialog::downloadFinished, this,
|
this, &AppDownloadBaseDialog::downloadFinished, this,
|
||||||
[this, selectedDevice](bool success) {
|
[this, selectedDevice](bool success) {
|
||||||
if (success) {
|
if (success) {
|
||||||
qDebug() << "Download finished, starting installation...";
|
qDebug() << "Download finished, starting installation...";
|
||||||
/*
|
|
||||||
FIXME: libipatool generates random id and appends that
|
QString ipaFile = ipaPathFromIpatool(m_bundleId);
|
||||||
to the downloaded IPA filename, so we need to search for
|
if (ipaFile.isEmpty()) {
|
||||||
it.
|
|
||||||
*/
|
|
||||||
// Find the actual downloaded IPA file
|
|
||||||
QDir outDir(m_tempDir->path());
|
|
||||||
QStringList filters;
|
|
||||||
filters << m_bundleId + "*.ipa";
|
|
||||||
QStringList matches =
|
|
||||||
outDir.entryList(filters, QDir::Files, QDir::Time);
|
|
||||||
if (matches.isEmpty()) {
|
|
||||||
m_statusLabel->setText("Download failed - IPA not found");
|
m_statusLabel->setText("Download failed - IPA not found");
|
||||||
setLabelTextColor(m_statusLabel, Qt::red);
|
setLabelTextColor(m_statusLabel, Qt::red);
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
this, "Error",
|
this, "Error",
|
||||||
QString("Downloaded IPA not found in %1")
|
QString(
|
||||||
.arg(outDir.absolutePath()));
|
"Downloaded IPA path not reported by libipatool"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
qDebug() << "Found downloaded IPA:" << matches.first();
|
|
||||||
QString ipaFile = outDir.filePath(matches.first());
|
|
||||||
performInstallation(ipaFile, matches.first(), selectedDevice);
|
|
||||||
|
|
||||||
} else {
|
QFileInfo fi(ipaFile);
|
||||||
m_statusLabel->setText("Download failed");
|
qDebug() << "IPA:" << ipaFile;
|
||||||
setLabelTextColor(m_statusLabel, Qt::red);
|
performInstallation(ipaFile, fi.fileName(), selectedDevice);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user