mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-13 05:37:42 +02:00
Apply suggestion from code review
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@ -463,12 +463,10 @@ QString JavaUtils::getJavaCheckPath()
|
||||
|
||||
QStringList getMinecraftJavaBundle()
|
||||
{
|
||||
QString executable = "java";
|
||||
QStringList processpaths;
|
||||
#if defined(Q_OS_OSX)
|
||||
processpaths << FS::PathCombine(QDir::homePath(), FS::PathCombine("Library", "Application Support", "minecraft", "runtime"));
|
||||
#elif defined(Q_OS_WIN32)
|
||||
executable += "w.exe";
|
||||
|
||||
auto appDataPath = QProcessEnvironment::systemEnvironment().value("APPDATA", "");
|
||||
processpaths << FS::PathCombine(QFileInfo(appDataPath).absoluteFilePath(), ".minecraft", "runtime");
|
||||
@ -493,7 +491,7 @@ QStringList getMinecraftJavaBundle()
|
||||
auto binFound = false;
|
||||
for (auto& entry : entries) {
|
||||
if (entry.baseName() == "bin") {
|
||||
javas.append(FS::PathCombine(entry.canonicalFilePath(), executable));
|
||||
javas.append(FS::PathCombine(entry.canonicalFilePath(), JavaUtils::javaExecutable));
|
||||
binFound = true;
|
||||
break;
|
||||
}
|
||||
@ -507,19 +505,20 @@ QStringList getMinecraftJavaBundle()
|
||||
return javas;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
const QString JavaUtils::javaExecutable = "javaw.exe";
|
||||
#else
|
||||
const QString JavaUtils::javaExecutable = "java";
|
||||
#endif
|
||||
|
||||
QStringList getPrismJavaBundle()
|
||||
{
|
||||
QList<QString> javas;
|
||||
|
||||
QString executable = "java";
|
||||
#if defined(Q_OS_WIN32)
|
||||
executable += "w.exe";
|
||||
#endif
|
||||
|
||||
auto scanDir = [&](QString prefix) {
|
||||
javas.append(FS::PathCombine(prefix, "jre", "bin", executable));
|
||||
javas.append(FS::PathCombine(prefix, "bin", executable));
|
||||
javas.append(FS::PathCombine(prefix, executable));
|
||||
javas.append(FS::PathCombine(prefix, "jre", "bin", JavaUtils::javaExecutable));
|
||||
javas.append(FS::PathCombine(prefix, "bin", JavaUtils::javaExecutable));
|
||||
javas.append(FS::PathCombine(prefix, JavaUtils::javaExecutable));
|
||||
};
|
||||
auto scanJavaDir = [&](const QString& dirPath) {
|
||||
QDir dir(dirPath);
|
||||
|
Reference in New Issue
Block a user