mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-10-04 09:08:42 +00:00
GH-4014 change updater to recognize new Qt 5.15.2 builds
This commit is contained in:
@@ -91,7 +91,8 @@ using namespace Commandline;
|
||||
"This usually fixes the problem and you can move the application elsewhere afterwards.\n"\
|
||||
"\n"
|
||||
|
||||
static void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||
namespace {
|
||||
void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||
{
|
||||
const char *levels = "DWCFIS";
|
||||
const QString format("%1 %2 %3\n");
|
||||
@@ -111,6 +112,43 @@ static void appDebugOutput(QtMsgType type, const QMessageLogContext &context, co
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
QString getIdealPlatform(QString currentPlatform) {
|
||||
auto info = Sys::getKernelInfo();
|
||||
switch(info.kernelType) {
|
||||
case Sys::KernelType::Darwin: {
|
||||
if(info.kernelMajor >= 17) {
|
||||
// macOS 10.13 or newer
|
||||
return "osx64-5.15.2";
|
||||
}
|
||||
else {
|
||||
// macOS 10.12 or older
|
||||
return "osx64";
|
||||
}
|
||||
}
|
||||
case Sys::KernelType::Windows: {
|
||||
if(info.kernelMajor == 6 && info.kernelMinor >= 1) {
|
||||
// Windows 7
|
||||
return "win32-5.15.2";
|
||||
}
|
||||
else if (info.kernelMajor > 6) {
|
||||
// Above Windows 7
|
||||
return "win32-5.15.2";
|
||||
}
|
||||
else {
|
||||
// Below Windows 7
|
||||
return "win32";
|
||||
}
|
||||
}
|
||||
case Sys::KernelType::Undetermined:
|
||||
case Sys::KernelType::Linux: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return currentPlatform;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
|
||||
{
|
||||
#if defined Q_OS_WIN32
|
||||
@@ -678,7 +716,10 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
|
||||
// initialize the updater
|
||||
if(BuildConfig.UPDATER_ENABLED)
|
||||
{
|
||||
m_updateChecker.reset(new UpdateChecker(BuildConfig.CHANLIST_URL, BuildConfig.VERSION_CHANNEL, BuildConfig.VERSION_BUILD));
|
||||
auto platform = getIdealPlatform(BuildConfig.BUILD_PLATFORM);
|
||||
auto channelUrl = BuildConfig.UPDATER_BASE + platform + "/channels.json";
|
||||
qDebug() << "Initializing updater with platform: " << platform << " -- " << channelUrl;
|
||||
m_updateChecker.reset(new UpdateChecker(channelUrl, BuildConfig.VERSION_CHANNEL, BuildConfig.VERSION_BUILD));
|
||||
qDebug() << "<> Updater started.";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user