Merge pull request #823 from BalkanMadman/linux-java

Fix https://github.com/PrismLauncher/PrismLauncher/issues/790
This commit is contained in:
Sefa Eyeoglu 2023-02-05 19:09:48 +01:00 committed by GitHub
commit e89a10945c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -412,8 +412,6 @@ QList<QString> JavaUtils::FindJavaPaths()
#elif defined(Q_OS_LINUX) #elif defined(Q_OS_LINUX)
QList<QString> JavaUtils::FindJavaPaths() QList<QString> JavaUtils::FindJavaPaths()
{ {
qDebug() << "Linux Java detection incomplete - defaulting to \"java\"";
QList<QString> javas; QList<QString> javas;
javas.append(this->GetDefaultJava()->path); javas.append(this->GetDefaultJava()->path);
auto scanJavaDir = [&](const QString & dirPath) auto scanJavaDir = [&](const QString & dirPath)
@ -421,20 +419,11 @@ QList<QString> JavaUtils::FindJavaPaths()
QDir dir(dirPath); QDir dir(dirPath);
if(!dir.exists()) if(!dir.exists())
return; return;
auto entries = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); auto entries = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
for(auto & entry: entries) for(auto & entry: entries)
{ {
QString prefix; QString prefix;
if(entry.isAbsolute()) prefix = entry.canonicalFilePath();
{
prefix = entry.absoluteFilePath();
}
else
{
prefix = entry.filePath();
}
javas.append(FS::PathCombine(prefix, "jre/bin/java")); javas.append(FS::PathCombine(prefix, "jre/bin/java"));
javas.append(FS::PathCombine(prefix, "bin/java")); javas.append(FS::PathCombine(prefix, "bin/java"));
} }