From 1471eddc7e9a5383218daf0fb271987d81e7096b Mon Sep 17 00:00:00 2001 From: AliceDTRH <57547425+AliceDTRH@users.noreply.github.com> Date: Sat, 22 Oct 2022 16:40:31 +0200 Subject: [PATCH 1/2] Deduplicates java installs before passing it on Signed-off-by: AliceDTRH <57547425+AliceDTRH@users.noreply.github.com> --- launcher/java/JavaUtils.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/launcher/java/JavaUtils.cpp b/launcher/java/JavaUtils.cpp index 040fe821..81b3a0b2 100644 --- a/launcher/java/JavaUtils.cpp +++ b/launcher/java/JavaUtils.cpp @@ -379,7 +379,9 @@ QList JavaUtils::FindJavaPaths() } } - return addJavasFromEnv(candidates); + javas = addJavasFromEnv(javas); + javas.removeDuplicates(); + return javas; } #elif defined(Q_OS_MAC) @@ -402,7 +404,9 @@ QList JavaUtils::FindJavaPaths() javas.append(systemLibraryJVMDir.absolutePath() + "/" + java + "/Contents/Home/bin/java"); javas.append(systemLibraryJVMDir.absolutePath() + "/" + java + "/Contents/Commands/java"); } - return addJavasFromEnv(javas); + javas = addJavasFromEnv(javas); + javas.removeDuplicates(); + return javas; } #elif defined(Q_OS_LINUX) @@ -448,7 +452,9 @@ QList JavaUtils::FindJavaPaths() scanJavaDir("/opt/jdks"); // flatpak scanJavaDir("/app/jdk"); - return addJavasFromEnv(javas); + javas = addJavasFromEnv(javas); + javas.removeDuplicates(); + return javas; } #else QList JavaUtils::FindJavaPaths() From b2789fef0fd91b6088bc8ec5ea17ea3b59810c96 Mon Sep 17 00:00:00 2001 From: AliceDTRH <57547425+AliceDTRH@users.noreply.github.com> Date: Sat, 22 Oct 2022 17:19:34 +0200 Subject: [PATCH 2/2] Use correct variable for Windows Signed-off-by: AliceDTRH <57547425+AliceDTRH@users.noreply.github.com> --- launcher/java/JavaUtils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/launcher/java/JavaUtils.cpp b/launcher/java/JavaUtils.cpp index 81b3a0b2..6c0c60cd 100644 --- a/launcher/java/JavaUtils.cpp +++ b/launcher/java/JavaUtils.cpp @@ -379,9 +379,9 @@ QList JavaUtils::FindJavaPaths() } } - javas = addJavasFromEnv(javas); - javas.removeDuplicates(); - return javas; + candidates = addJavasFromEnv(candidates); + candidates.removeDuplicates(); + return candidates; } #elif defined(Q_OS_MAC)