+6
-10
@@ -4,9 +4,9 @@
|
||||
#include <QDirIterator>
|
||||
#include <QFileInfo>
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QObject>
|
||||
#include <QRegularExpression>
|
||||
#include <QStandardPaths>
|
||||
#include <utility>
|
||||
@@ -75,10 +75,8 @@ QStringList JavaLocator::findAll(const QString &gameDir)
|
||||
// 1. Рантайм, скачанный самим Minecraft: .minecraft/runtime/<component>/<os>/<component>/bin
|
||||
const QString runtime = gameDir + QStringLiteral("/runtime");
|
||||
if (QDir(runtime).exists()) {
|
||||
QDirIterator it(runtime,
|
||||
QStringList{QString::fromLatin1(kExecutable)},
|
||||
QDir::Files | QDir::Executable,
|
||||
QDirIterator::Subdirectories);
|
||||
QDirIterator it(runtime, QStringList{QString::fromLatin1(kExecutable)},
|
||||
QDir::Files | QDir::Executable, QDirIterator::Subdirectories);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
appendIfExecutable(result, it.fileInfo().absolutePath());
|
||||
@@ -105,7 +103,7 @@ QStringList JavaLocator::findAll(const QString &gameDir)
|
||||
for (const QString &entry : entries) {
|
||||
const QString home = dir.absoluteFilePath(entry);
|
||||
appendIfExecutable(result, home + QStringLiteral("/bin"));
|
||||
appendIfExecutable(result, home + QStringLiteral("/Contents/Home/bin")); // macOS
|
||||
appendIfExecutable(result, home + QStringLiteral("/Contents/Home/bin")); // macOS
|
||||
appendIfExecutable(result, home + QStringLiteral("/jre/bin"));
|
||||
}
|
||||
}
|
||||
@@ -174,8 +172,7 @@ QString JavaLocator::select(const QString &gameDir,
|
||||
|
||||
if (candidates.isEmpty()) {
|
||||
if (error)
|
||||
*error = QObject::tr(
|
||||
"Java не найдена. Установите JDK %1 или укажите путь в настройках.")
|
||||
*error = QObject::tr("Java не найдена. Установите JDK %1 или укажите путь в настройках.")
|
||||
.arg(requiredMajor);
|
||||
return {};
|
||||
}
|
||||
@@ -194,8 +191,7 @@ QString JavaLocator::select(const QString &gameDir,
|
||||
|
||||
if (error) {
|
||||
*error = bestBelowMajor > 0
|
||||
? QObject::tr(
|
||||
"Для этой версии нужна Java %1 или новее, найдена только Java %2 (%3).")
|
||||
? QObject::tr("Для этой версии нужна Java %1 или новее, найдена только Java %2 (%3).")
|
||||
.arg(requiredMajor)
|
||||
.arg(bestBelowMajor)
|
||||
.arg(QDir::toNativeSeparators(bestBelow))
|
||||
|
||||
Reference in New Issue
Block a user