fix(updater) fixes form first round of testing
- reset update time after check Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
parent
cb7ff81ade
commit
e38adf6006
@ -77,6 +77,8 @@ Config::Config()
|
|||||||
if (BUILD_PLATFORM == "macOS" && !MAC_SPARKLE_PUB_KEY.isEmpty() && !MAC_SPARKLE_APPCAST_URL.isEmpty())
|
if (BUILD_PLATFORM == "macOS" && !MAC_SPARKLE_PUB_KEY.isEmpty() && !MAC_SPARKLE_APPCAST_URL.isEmpty())
|
||||||
{
|
{
|
||||||
UPDATER_ENABLED = true;
|
UPDATER_ENABLED = true;
|
||||||
|
} else if(!UPDATER_GITHUB_REPO.isEmpty() && !BUILD_ARTIFACT.isEmpty()) {
|
||||||
|
UPDATER_ENABLED = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GIT_COMMIT = "@Launcher_GIT_COMMIT@";
|
GIT_COMMIT = "@Launcher_GIT_COMMIT@";
|
||||||
@ -97,10 +99,7 @@ Config::Config()
|
|||||||
if (GIT_REFSPEC.startsWith("refs/heads/"))
|
if (GIT_REFSPEC.startsWith("refs/heads/"))
|
||||||
{
|
{
|
||||||
VERSION_CHANNEL = GIT_REFSPEC;
|
VERSION_CHANNEL = GIT_REFSPEC;
|
||||||
VERSION_CHANNEL.remove("refs/heads/");
|
VERSION_CHANNEL.remove("refs/heads/");
|
||||||
if(!UPDATER_GITHUB_REPO.isEmpty() && !BUILD_PLATFORM.isEmpty()) {
|
|
||||||
UPDATER_ENABLED = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (!GIT_COMMIT.isEmpty())
|
else if (!GIT_COMMIT.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -584,6 +584,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||||||
qDebug() << "Git refspec : " << BuildConfig.GIT_REFSPEC;
|
qDebug() << "Git refspec : " << BuildConfig.GIT_REFSPEC;
|
||||||
qDebug() << "Compiled for : " << BuildConfig.systemID();
|
qDebug() << "Compiled for : " << BuildConfig.systemID();
|
||||||
qDebug() << "Compiled by : " << BuildConfig.compilerID();
|
qDebug() << "Compiled by : " << BuildConfig.compilerID();
|
||||||
|
qDebug() << "Build Artifact : " << BuildConfig.BUILD_ARTIFACT;
|
||||||
|
qDebug() << "Updates Enabeled : " << (updaterEnabled() ? "Yes" : "No");
|
||||||
if (adjustedBy.size()) {
|
if (adjustedBy.size()) {
|
||||||
qDebug() << "Work dir before adjustment : " << origcwdPath;
|
qDebug() << "Work dir before adjustment : " << origcwdPath;
|
||||||
qDebug() << "Work dir after adjustment : " << QDir::currentPath();
|
qDebug() << "Work dir after adjustment : " << QDir::currentPath();
|
||||||
@ -856,18 +858,12 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// initialize the updater
|
// initialize the updater
|
||||||
if (BuildConfig.UPDATER_ENABLED) {
|
if (updaterEnabled()) {
|
||||||
qDebug() << "Initializing updater";
|
qDebug() << "Initializing updater";
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
m_updater.reset(new MacSparkleUpdater());
|
m_updater.reset(new MacSparkleUpdater());
|
||||||
#else
|
#else
|
||||||
auto exe_name = QStringLiteral("%1_updater").arg(BuildConfig.LAUNCHER_APP_BINARY_NAME);
|
m_updater.reset(new PrismExternalUpdater(applicationDirPath(), m_dataPath));
|
||||||
#if defined Q_OS_WIN32
|
|
||||||
exe_name.append(".exe");
|
|
||||||
#endif
|
|
||||||
auto updater_binary = QFileInfo(QDir(m_rootPath).absoluteFilePath(exe_name));
|
|
||||||
if (updater_binary.isFile())
|
|
||||||
m_updater.reset(new PrismExternalUpdater(m_rootPath, m_dataPath));
|
|
||||||
#endif
|
#endif
|
||||||
qDebug() << "<> Updater started.";
|
qDebug() << "<> Updater started.";
|
||||||
}
|
}
|
||||||
@ -1000,6 +996,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||||||
msgBox.setDefaultButton(QMessageBox::Abort);
|
msgBox.setDefaultButton(QMessageBox::Abort);
|
||||||
msgBox.setModal(true);
|
msgBox.setModal(true);
|
||||||
msgBox.setDetailedText(FS::read(update_log_path));
|
msgBox.setDetailedText(FS::read(update_log_path));
|
||||||
|
msgBox.adjustSize();
|
||||||
auto res = msgBox.exec();
|
auto res = msgBox.exec();
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case QMessageBox::Ignore: {
|
case QMessageBox::Ignore: {
|
||||||
@ -1030,6 +1027,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||||||
msgBox.setDefaultButton(QMessageBox::Abort);
|
msgBox.setDefaultButton(QMessageBox::Abort);
|
||||||
msgBox.setModal(true);
|
msgBox.setModal(true);
|
||||||
msgBox.setDetailedText(FS::read(update_log_path));
|
msgBox.setDetailedText(FS::read(update_log_path));
|
||||||
|
msgBox.adjustSize();
|
||||||
auto res = msgBox.exec();
|
auto res = msgBox.exec();
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case QMessageBox::Ignore: {
|
case QMessageBox::Ignore: {
|
||||||
@ -1056,10 +1054,12 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||||||
"for details.")
|
"for details.")
|
||||||
.arg(BuildConfig.printableVersionString())
|
.arg(BuildConfig.printableVersionString())
|
||||||
.arg(update_log_path);
|
.arg(update_log_path);
|
||||||
auto msgBox = QMessageBox(QMessageBox::Information, tr("Update Succeeded"), infoMsg, QMessageBox::Ok);
|
auto msgBox = new QMessageBox(QMessageBox::Information, tr("Update Succeeded"), infoMsg, QMessageBox::Ok);
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||||
msgBox.setDetailedText(FS::read(update_log_path));
|
msgBox->setDetailedText(FS::read(update_log_path));
|
||||||
msgBox.exec();
|
msgBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
msgBox->adjustSize();
|
||||||
|
msgBox->open();
|
||||||
FS::deletePath(update_success_marker.absoluteFilePath());
|
FS::deletePath(update_success_marker.absoluteFilePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1127,6 +1127,22 @@ bool Application::createSetupWizard()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Application::updaterEnabled() {
|
||||||
|
#if defined(Q_OS_MAC)
|
||||||
|
return BuildConfig.UPDATER_ENABLED;
|
||||||
|
#else
|
||||||
|
return BuildConfig.UPDATER_ENABLED && QFileInfo(updaterBinaryName()).isFile();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Application::updaterBinaryName() {
|
||||||
|
auto exe_name = QStringLiteral("%1_updater").arg(BuildConfig.LAUNCHER_APP_BINARY_NAME);
|
||||||
|
#if defined Q_OS_WIN32
|
||||||
|
exe_name.append(".exe");
|
||||||
|
#endif
|
||||||
|
return exe_name;
|
||||||
|
}
|
||||||
|
|
||||||
bool Application::event(QEvent* event)
|
bool Application::event(QEvent* event)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
|
@ -216,6 +216,9 @@ public:
|
|||||||
|
|
||||||
int suitableMaxMem();
|
int suitableMaxMem();
|
||||||
|
|
||||||
|
bool updaterEnabled();
|
||||||
|
QString updaterBinaryName();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void updateAllowedChanged(bool status);
|
void updateAllowedChanged(bool status);
|
||||||
void globalSettingsAboutToOpen();
|
void globalSettingsAboutToOpen();
|
||||||
|
@ -215,7 +215,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
ui->actionDISCORD->setVisible(!BuildConfig.DISCORD_URL.isEmpty());
|
ui->actionDISCORD->setVisible(!BuildConfig.DISCORD_URL.isEmpty());
|
||||||
ui->actionREDDIT->setVisible(!BuildConfig.SUBREDDIT_URL.isEmpty());
|
ui->actionREDDIT->setVisible(!BuildConfig.SUBREDDIT_URL.isEmpty());
|
||||||
|
|
||||||
ui->actionCheckUpdate->setVisible(BuildConfig.UPDATER_ENABLED);
|
ui->actionCheckUpdate->setVisible(APPLICATION->updaterEnabled());
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
ui->actionAddToPATH->setVisible(false);
|
ui->actionAddToPATH->setVisible(false);
|
||||||
@ -388,7 +388,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
updateNewsLabel();
|
updateNewsLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BuildConfig.UPDATER_ENABLED) {
|
if (APPLICATION->updaterEnabled()) {
|
||||||
bool updatesAllowed = APPLICATION->updatesAreAllowed();
|
bool updatesAllowed = APPLICATION->updatesAreAllowed();
|
||||||
updatesAllowedChanged(updatesAllowed);
|
updatesAllowedChanged(updatesAllowed);
|
||||||
|
|
||||||
@ -781,7 +781,7 @@ void MainWindow::repopulateAccountsMenu()
|
|||||||
|
|
||||||
void MainWindow::updatesAllowedChanged(bool allowed)
|
void MainWindow::updatesAllowedChanged(bool allowed)
|
||||||
{
|
{
|
||||||
if(!BuildConfig.UPDATER_ENABLED)
|
if(!APPLICATION->updaterEnabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1259,7 +1259,7 @@ void MainWindow::on_actionViewCentralModsFolder_triggered()
|
|||||||
|
|
||||||
void MainWindow::checkForUpdates()
|
void MainWindow::checkForUpdates()
|
||||||
{
|
{
|
||||||
if(BuildConfig.UPDATER_ENABLED)
|
if(APPLICATION->updaterEnabled())
|
||||||
{
|
{
|
||||||
APPLICATION->triggerUpdateCheck();
|
APPLICATION->triggerUpdateCheck();
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
class PrismExternalUpdater::Private {
|
class PrismExternalUpdater::Private {
|
||||||
public:
|
public:
|
||||||
QDir appDir;
|
QDir binDir;
|
||||||
QDir dataDir;
|
QDir dataDir;
|
||||||
QTimer updateTimer;
|
QTimer updateTimer;
|
||||||
bool allowBeta;
|
bool allowBeta;
|
||||||
@ -50,10 +50,10 @@ class PrismExternalUpdater::Private {
|
|||||||
std::unique_ptr<QSettings> settings;
|
std::unique_ptr<QSettings> settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
PrismExternalUpdater::PrismExternalUpdater(const QString& appDir, const QString& dataDir)
|
PrismExternalUpdater::PrismExternalUpdater(const QString& binDir, const QString& dataDir)
|
||||||
{
|
{
|
||||||
priv = new PrismExternalUpdater::Private();
|
priv = new PrismExternalUpdater::Private();
|
||||||
priv->appDir = QDir(appDir);
|
priv->binDir = QDir(binDir);
|
||||||
priv->dataDir = QDir(dataDir);
|
priv->dataDir = QDir(dataDir);
|
||||||
auto settings_file = priv->dataDir.absoluteFilePath("prismlauncher_update.cfg");
|
auto settings_file = priv->dataDir.absoluteFilePath("prismlauncher_update.cfg");
|
||||||
priv->settings = std::make_unique<QSettings>(settings_file, QSettings::Format::IniFormat);
|
priv->settings = std::make_unique<QSettings>(settings_file, QSettings::Format::IniFormat);
|
||||||
@ -97,20 +97,42 @@ void PrismExternalUpdater::checkForUpdates()
|
|||||||
if (priv->allowBeta)
|
if (priv->allowBeta)
|
||||||
args.append("--pre-release");
|
args.append("--pre-release");
|
||||||
|
|
||||||
proc.start(priv->appDir.absoluteFilePath(exe_name), args);
|
proc.start(priv->binDir.absoluteFilePath(exe_name), args);
|
||||||
auto result_start = proc.waitForStarted(5000);
|
auto result_start = proc.waitForStarted(5000);
|
||||||
if (!result_start) {
|
if (!result_start) {
|
||||||
auto err = proc.error();
|
auto err = proc.error();
|
||||||
qDebug() << "Failed to start updater after 5 seconds."
|
qDebug() << "Failed to start updater after 5 seconds."
|
||||||
<< "reason:" << err << proc.errorString();
|
<< "reason:" << err << proc.errorString();
|
||||||
|
auto msgBox = QMessageBox(QMessageBox::Information, tr("Update Check Failed"),
|
||||||
|
tr("Failed to start after 5 seconds\nReason: %1.").arg(proc.errorString()));
|
||||||
|
|
||||||
|
msgBox.adjustSize();
|
||||||
|
msgBox.exec();
|
||||||
|
priv->lastCheck = QDateTime::currentDateTime();
|
||||||
|
priv->settings->setValue("last_check", priv->lastCheck.toString(Qt::ISODate));
|
||||||
|
priv->settings->sync();
|
||||||
|
resetAutoCheckTimer();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
|
|
||||||
auto result_finished = proc.waitForFinished(60000);
|
auto result_finished = proc.waitForFinished(60000);
|
||||||
if (!result_finished) {
|
if (!result_finished) {
|
||||||
|
proc.kill();
|
||||||
auto err = proc.error();
|
auto err = proc.error();
|
||||||
|
auto output = proc.readAll();
|
||||||
qDebug() << "Updater failed to close after 60 seconds."
|
qDebug() << "Updater failed to close after 60 seconds."
|
||||||
<< "reason:" << err << proc.errorString();
|
<< "reason:" << err << proc.errorString();
|
||||||
|
auto msgBox = QMessageBox(QMessageBox::Information, tr("Update Check Failed"),
|
||||||
|
tr("Updater failed to close 60 seconds\nReason: %1.").arg(proc.errorString()));
|
||||||
|
msgBox.setDetailedText(output);
|
||||||
|
msgBox.adjustSize();
|
||||||
|
msgBox.exec();
|
||||||
|
priv->lastCheck = QDateTime::currentDateTime();
|
||||||
|
priv->settings->setValue("last_check", priv->lastCheck.toString(Qt::ISODate));
|
||||||
|
priv->settings->sync();
|
||||||
|
resetAutoCheckTimer();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto exit_code = proc.exitCode();
|
auto exit_code = proc.exitCode();
|
||||||
@ -127,6 +149,8 @@ void PrismExternalUpdater::checkForUpdates()
|
|||||||
{
|
{
|
||||||
qDebug() << "No update available";
|
qDebug() << "No update available";
|
||||||
auto msgBox = QMessageBox(QMessageBox::Information, tr("No Update Available"), tr("You are running the latest version."));
|
auto msgBox = QMessageBox(QMessageBox::Information, tr("No Update Available"), tr("You are running the latest version."));
|
||||||
|
|
||||||
|
msgBox.adjustSize();
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -137,6 +161,8 @@ void PrismExternalUpdater::checkForUpdates()
|
|||||||
auto msgBox =
|
auto msgBox =
|
||||||
QMessageBox(QMessageBox::Warning, tr("Update Check Error"), tr("There was an error running the update check."));
|
QMessageBox(QMessageBox::Warning, tr("Update Check Error"), tr("There was an error running the update check."));
|
||||||
msgBox.setDetailedText(std_error);
|
msgBox.setDetailedText(std_error);
|
||||||
|
|
||||||
|
msgBox.adjustSize();
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -159,11 +185,19 @@ void PrismExternalUpdater::checkForUpdates()
|
|||||||
// unknown error code
|
// unknown error code
|
||||||
{
|
{
|
||||||
qDebug() << "Updater exited with unknown code" << exit_code;
|
qDebug() << "Updater exited with unknown code" << exit_code;
|
||||||
|
auto msgBox = QMessageBox(QMessageBox::Information, tr("Unknown Update Error"),
|
||||||
|
tr("The updater exited with an unknown condition.\nExit Code: %1").arg(exit_code));
|
||||||
|
auto detail_txt = tr("StdOut: %1\nStdErr: %2").arg(std_output).arg(std_error);
|
||||||
|
msgBox.setDetailedText(detail_txt);
|
||||||
|
|
||||||
|
msgBox.adjustSize();
|
||||||
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
priv->lastCheck = QDateTime::currentDateTime();
|
priv->lastCheck = QDateTime::currentDateTime();
|
||||||
priv->settings->setValue("last_check", priv->lastCheck.toString(Qt::ISODate));
|
priv->settings->setValue("last_check", priv->lastCheck.toString(Qt::ISODate));
|
||||||
priv->settings->sync();
|
priv->settings->sync();
|
||||||
|
resetAutoCheckTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrismExternalUpdater::getAutomaticallyChecksForUpdates()
|
bool PrismExternalUpdater::getAutomaticallyChecksForUpdates()
|
||||||
@ -247,6 +281,8 @@ void PrismExternalUpdater::offerUpdate(const QString& version_name, const QStrin
|
|||||||
|
|
||||||
if (should_skip) {
|
if (should_skip) {
|
||||||
auto msgBox = QMessageBox(QMessageBox::Information, tr("No Update Available"), tr("There are no new updates available."));
|
auto msgBox = QMessageBox(QMessageBox::Information, tr("No Update Available"), tr("There are no new updates available."));
|
||||||
|
|
||||||
|
msgBox.adjustSize();
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -285,7 +321,7 @@ void PrismExternalUpdater::performUpdate(const QString& version_tag)
|
|||||||
if (priv->allowBeta)
|
if (priv->allowBeta)
|
||||||
args.append("--pre-release");
|
args.append("--pre-release");
|
||||||
|
|
||||||
auto result = proc.startDetached(priv->appDir.absoluteFilePath(exe_name), args);
|
auto result = proc.startDetached(priv->binDir.absoluteFilePath(exe_name), args);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
qDebug() << "Failed to start updater:" << proc.error() << proc.errorString();
|
qDebug() << "Failed to start updater:" << proc.error() << proc.errorString();
|
||||||
}
|
}
|
||||||
|
@ -350,14 +350,14 @@ PrismUpdaterApp::PrismUpdaterApp(int& argc, char** argv) : QApplication(argc, ar
|
|||||||
|
|
||||||
{ // setup logging
|
{ // setup logging
|
||||||
static const QString baseLogFile = BuildConfig.LAUNCHER_NAME + "Updater" + (m_checkOnly ? "-CheckOnly" : "") + "-%0.log";
|
static const QString baseLogFile = BuildConfig.LAUNCHER_NAME + "Updater" + (m_checkOnly ? "-CheckOnly" : "") + "-%0.log";
|
||||||
static const QString logBase = FS::PathCombine("logs", baseLogFile);
|
static const QString logBase = FS::PathCombine(m_dataPath, "logs", baseLogFile);
|
||||||
auto moveFile = [](const QString& oldName, const QString& newName) {
|
auto moveFile = [](const QString& oldName, const QString& newName) {
|
||||||
QFile::remove(newName);
|
QFile::remove(newName);
|
||||||
QFile::copy(oldName, newName);
|
QFile::copy(oldName, newName);
|
||||||
QFile::remove(oldName);
|
QFile::remove(oldName);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (FS::ensureFolderPathExists("logs")) {
|
if (FS::ensureFolderPathExists("logs")) { // enough history to track both launches of the updater during a portable install
|
||||||
moveFile(logBase.arg(1), logBase.arg(2));
|
moveFile(logBase.arg(1), logBase.arg(2));
|
||||||
moveFile(logBase.arg(0), logBase.arg(1));
|
moveFile(logBase.arg(0), logBase.arg(1));
|
||||||
}
|
}
|
||||||
@ -442,6 +442,7 @@ PrismUpdaterApp::PrismUpdaterApp(int& argc, char** argv) : QApplication(argc, ar
|
|||||||
qDebug() << "Git refspec : " << BuildConfig.GIT_REFSPEC;
|
qDebug() << "Git refspec : " << BuildConfig.GIT_REFSPEC;
|
||||||
qDebug() << "Compiled for : " << BuildConfig.systemID();
|
qDebug() << "Compiled for : " << BuildConfig.systemID();
|
||||||
qDebug() << "Compiled by : " << BuildConfig.compilerID();
|
qDebug() << "Compiled by : " << BuildConfig.compilerID();
|
||||||
|
qDebug() << "Build Artifact : " << BuildConfig.BUILD_ARTIFACT;
|
||||||
if (adjustedBy.size()) {
|
if (adjustedBy.size()) {
|
||||||
qDebug() << "Data dir before adjustment : " << origCwdPath;
|
qDebug() << "Data dir before adjustment : " << origCwdPath;
|
||||||
qDebug() << "Data dir after adjustment : " << m_dataPath;
|
qDebug() << "Data dir after adjustment : " << m_dataPath;
|
||||||
@ -521,6 +522,7 @@ void PrismUpdaterApp::showFatalErrorMessage(const QString& title, const QString&
|
|||||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||||
msgBox->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
|
msgBox->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
|
||||||
msgBox->setIcon(QMessageBox::Critical);
|
msgBox->setIcon(QMessageBox::Critical);
|
||||||
|
msgBox->adjustSize();
|
||||||
msgBox->exec();
|
msgBox->exec();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -658,6 +660,7 @@ void PrismUpdaterApp::moveAndFinishUpdate(QDir target)
|
|||||||
|
|
||||||
QProgressDialog progress(tr("Backing up install at %1").arg(applicationDirPath()), "", 0, file_list.length());
|
QProgressDialog progress(tr("Backing up install at %1").arg(applicationDirPath()), "", 0, file_list.length());
|
||||||
progress.setCancelButton(nullptr);
|
progress.setCancelButton(nullptr);
|
||||||
|
progress.adjustSize();
|
||||||
progress.show();
|
progress.show();
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
|
|
||||||
@ -766,10 +769,13 @@ QList<GitHubReleaseAsset> PrismUpdaterApp::validReleaseArtifacts(const GitHubRel
|
|||||||
if (BuildConfig.BUILD_ARTIFACT.isEmpty())
|
if (BuildConfig.BUILD_ARTIFACT.isEmpty())
|
||||||
qWarning() << "Build platform is not set!";
|
qWarning() << "Build platform is not set!";
|
||||||
for (auto asset : release.assets) {
|
for (auto asset : release.assets) {
|
||||||
if (!m_isAppimage && asset.name.toLower().endsWith("appimage"))
|
if (!m_isAppimage && asset.name.toLower().endsWith("appimage")) {
|
||||||
|
qDebug() << "Rejecting" << asset.name << "because it is an AppImage";
|
||||||
continue;
|
continue;
|
||||||
else if (m_isAppimage && !asset.name.toLower().endsWith("appimage"))
|
} else if (m_isAppimage && !asset.name.toLower().endsWith("appimage")) {
|
||||||
|
qDebug() << "Rejecting" << asset.name << "because it is not an AppImage";
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
auto asset_name = asset.name.toLower();
|
auto asset_name = asset.name.toLower();
|
||||||
auto platform = BuildConfig.BUILD_ARTIFACT.toLower();
|
auto platform = BuildConfig.BUILD_ARTIFACT.toLower();
|
||||||
auto system_is_arm = QSysInfo::buildCpuArchitecture().contains("arm64");
|
auto system_is_arm = QSysInfo::buildCpuArchitecture().contains("arm64");
|
||||||
@ -786,6 +792,8 @@ QList<GitHubReleaseAsset> PrismUpdaterApp::validReleaseArtifacts(const GitHubRel
|
|||||||
for_platform = false;
|
for_platform = false;
|
||||||
|
|
||||||
if (((m_isPortable && for_portable) || (!m_isPortable && !for_portable)) && for_platform) {
|
if (((m_isPortable && for_portable) || (!m_isPortable && !for_portable)) && for_platform) {
|
||||||
|
qDebug() << "Rejecting" << asset.name << "|"
|
||||||
|
<< "For Platform:" << (for_platform ? "Yes" : "No") << "For Portable:" << (for_portable ? "Yes" : "No");
|
||||||
valid.append(asset);
|
valid.append(asset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -849,6 +857,7 @@ QFileInfo PrismUpdaterApp::downloadAsset(const GitHubReleaseAsset& asset)
|
|||||||
auto download = Net::Download::makeFile(file_url, out_file_path);
|
auto download = Net::Download::makeFile(file_url, out_file_path);
|
||||||
download->setNetwork(m_network);
|
download->setNetwork(m_network);
|
||||||
auto progress_dialog = ProgressDialog();
|
auto progress_dialog = ProgressDialog();
|
||||||
|
progress_dialog.adjustSize();
|
||||||
|
|
||||||
if (progress_dialog.execWithTask(download.get()) == QDialog::Rejected)
|
if (progress_dialog.execWithTask(download.get()) == QDialog::Rejected)
|
||||||
showFatalErrorMessage(tr("Download Aborted"), tr("Download of %1 aborted by user").arg(file_url.toString()));
|
showFatalErrorMessage(tr("Download Aborted"), tr("Download of %1 aborted by user").arg(file_url.toString()));
|
||||||
@ -954,6 +963,7 @@ void PrismUpdaterApp::performInstall(QFileInfo file)
|
|||||||
msgBox.setInformativeText(infoMsg);
|
msgBox.setInformativeText(infoMsg);
|
||||||
msgBox.setStandardButtons(QMessageBox::Ignore | QMessageBox::Cancel);
|
msgBox.setStandardButtons(QMessageBox::Ignore | QMessageBox::Cancel);
|
||||||
msgBox.setDefaultButton(QMessageBox::Cancel);
|
msgBox.setDefaultButton(QMessageBox::Cancel);
|
||||||
|
msgBox.adjustSize();
|
||||||
switch (msgBox.exec()) {
|
switch (msgBox.exec()) {
|
||||||
case QMessageBox::AcceptRole:
|
case QMessageBox::AcceptRole:
|
||||||
break;
|
break;
|
||||||
@ -971,7 +981,7 @@ void PrismUpdaterApp::performInstall(QFileInfo file)
|
|||||||
logUpdate(tr("Updating from %1 to %2").arg(m_prismVersion).arg(m_install_release.tag_name));
|
logUpdate(tr("Updating from %1 to %2").arg(m_prismVersion).arg(m_install_release.tag_name));
|
||||||
if (m_isPortable || file.suffix().toLower() == "zip") {
|
if (m_isPortable || file.suffix().toLower() == "zip") {
|
||||||
write_lock_file(update_lock_path, QDateTime::currentDateTime(), m_prismVersion, m_install_release.tag_name, applicationDirPath(),
|
write_lock_file(update_lock_path, QDateTime::currentDateTime(), m_prismVersion, m_install_release.tag_name, applicationDirPath(),
|
||||||
m_dataPath);
|
m_dataPath);
|
||||||
logUpdate(tr("Updating portable install at %1").arg(applicationDirPath()));
|
logUpdate(tr("Updating portable install at %1").arg(applicationDirPath()));
|
||||||
unpackAndInstall(file);
|
unpackAndInstall(file);
|
||||||
} else {
|
} else {
|
||||||
@ -1065,6 +1075,7 @@ void PrismUpdaterApp::backupAppDir()
|
|||||||
|
|
||||||
QProgressDialog progress(tr("Backing up install at %1").arg(applicationDirPath()), "", 0, file_list.length());
|
QProgressDialog progress(tr("Backing up install at %1").arg(applicationDirPath()), "", 0, file_list.length());
|
||||||
progress.setCancelButton(nullptr);
|
progress.setCancelButton(nullptr);
|
||||||
|
progress.adjustSize();
|
||||||
progress.show();
|
progress.show();
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user