fixed appImageUpdate

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-09-28 15:14:59 +03:00
parent b8d9c3d779
commit 498c9db1ce
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 11 additions and 1 deletions

View File

@ -338,6 +338,8 @@ void PrismExternalUpdater::performUpdate(const QString& version_tag)
auto env = QProcessEnvironment::systemEnvironment(); auto env = QProcessEnvironment::systemEnvironment();
env.insert("__COMPAT_LAYER", "RUNASINVOKER"); env.insert("__COMPAT_LAYER", "RUNASINVOKER");
proc.setProcessEnvironment(env); proc.setProcessEnvironment(env);
#else
exe_name = QString("bin/%1").arg(exe_name);
#endif #endif
QStringList args = { "--dir", priv->dataDir.absolutePath(), "--install-version", version_tag }; QStringList args = { "--dir", priv->dataDir.absolutePath(), "--install-version", version_tag };

View File

@ -900,7 +900,7 @@ bool PrismUpdaterApp::callAppImageUpdate()
auto appimage_path = QProcessEnvironment::systemEnvironment().value(QStringLiteral("APPIMAGE")); auto appimage_path = QProcessEnvironment::systemEnvironment().value(QStringLiteral("APPIMAGE"));
QProcess proc = QProcess(); QProcess proc = QProcess();
qDebug() << "Calling: AppImageUpdate" << appimage_path; qDebug() << "Calling: AppImageUpdate" << appimage_path;
proc.setProgram("AppImageUpdate"); proc.setProgram("bin/AppImageUpdate");
proc.setArguments({ appimage_path }); proc.setArguments({ appimage_path });
auto result = proc.startDetached(); auto result = proc.startDetached();
if (!result) if (!result)
@ -1213,8 +1213,14 @@ bool PrismUpdaterApp::loadPrismVersionFromExe(const QString& exe_path)
} }
auto out = proc.readAllStandardOutput(); auto out = proc.readAllStandardOutput();
auto lines = out.split('\n'); auto lines = out.split('\n');
lines.removeAll("");
if (lines.length() < 2) if (lines.length() < 2)
return false; return false;
else if (lines.length() > 2) {
auto line1 = lines.takeLast();
auto line2 = lines.takeLast();
lines = { line2, line1 };
}
auto first = lines.takeFirst(); auto first = lines.takeFirst();
auto first_parts = first.split(' '); auto first_parts = first.split(' ');
if (first_parts.length() < 2) if (first_parts.length() < 2)
@ -1230,6 +1236,8 @@ bool PrismUpdaterApp::loadPrismVersionFromExe(const QString& exe_path)
m_prsimVersionChannel = "stable"; m_prsimVersionChannel = "stable";
} }
auto version_parts = version.split('.'); auto version_parts = version.split('.');
if (version_parts.length() < 2)
return false;
m_prismVersionMajor = version_parts.takeFirst().toInt(); m_prismVersionMajor = version_parts.takeFirst().toInt();
m_prismVersionMinor = version_parts.takeFirst().toInt(); m_prismVersionMinor = version_parts.takeFirst().toInt();
m_prismGitCommit = lines.takeFirst().simplified(); m_prismGitCommit = lines.takeFirst().simplified();