chore: clang-format RuntimeContext

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2022-10-15 12:43:15 +02:00
parent 545944cb0d
commit 3b92ec8e82
No known key found for this signature in database
GPG Key ID: C10411294912A422

View File

@ -28,7 +28,8 @@ struct RuntimeContext {
QString javaPath; QString javaPath;
QString system; QString system;
QString mappedJavaRealArchitecture() const { QString mappedJavaRealArchitecture() const
{
if (javaRealArchitecture == "amd64") if (javaRealArchitecture == "amd64")
return "x86_64"; return "x86_64";
if (javaRealArchitecture == "i386" || javaRealArchitecture == "i686") if (javaRealArchitecture == "i386" || javaRealArchitecture == "i686")
@ -40,24 +41,25 @@ struct RuntimeContext {
return javaRealArchitecture; return javaRealArchitecture;
} }
void updateFromInstanceSettings(SettingsObjectPtr instanceSettings) { void updateFromInstanceSettings(SettingsObjectPtr instanceSettings)
{
javaArchitecture = instanceSettings->get("JavaArchitecture").toString(); javaArchitecture = instanceSettings->get("JavaArchitecture").toString();
javaRealArchitecture = instanceSettings->get("JavaRealArchitecture").toString(); javaRealArchitecture = instanceSettings->get("JavaRealArchitecture").toString();
javaPath = instanceSettings->get("JavaPath").toString(); javaPath = instanceSettings->get("JavaPath").toString();
system = currentSystem(); system = currentSystem();
} }
QString getClassifier() const { QString getClassifier() const { return system + "-" + mappedJavaRealArchitecture(); }
return system + "-" + mappedJavaRealArchitecture();
}
// "Legacy" refers to the fact that Mojang assumed that these are the only two architectures // "Legacy" refers to the fact that Mojang assumed that these are the only two architectures
bool isLegacyArch() const { bool isLegacyArch() const
{
const QString mapped = mappedJavaRealArchitecture(); const QString mapped = mappedJavaRealArchitecture();
return mapped == "x86_64" || mapped == "x86"; return mapped == "x86_64" || mapped == "x86";
} }
bool classifierMatches(QString target) const { bool classifierMatches(QString target) const
{
// try to match precise classifier "[os]-[arch]" // try to match precise classifier "[os]-[arch]"
bool x = target == getClassifier(); bool x = target == getClassifier();
// try to match imprecise classifier on legacy architectures "[os]" // try to match imprecise classifier on legacy architectures "[os]"
@ -67,7 +69,8 @@ struct RuntimeContext {
return x; return x;
} }
static QString currentSystem() { static QString currentSystem()
{
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
return "linux"; return "linux";
#elif defined(Q_OS_MACOS) #elif defined(Q_OS_MACOS)