From c78d35d699bf204008da5eb73ed8c4efe510258d Mon Sep 17 00:00:00 2001 From: Trial97 Date: Tue, 7 Nov 2023 10:20:53 +0200 Subject: [PATCH] added additional minecraft java path for windows Signed-off-by: Trial97 --- launcher/java/JavaUtils.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/launcher/java/JavaUtils.cpp b/launcher/java/JavaUtils.cpp index 10bbb1f1b..615608ca3 100644 --- a/launcher/java/JavaUtils.cpp +++ b/launcher/java/JavaUtils.cpp @@ -34,6 +34,7 @@ */ #include +#include #include #include @@ -440,18 +441,26 @@ QStringList getMinecraftJavaBundle() { QString partialPath; QString executable = "java"; + QStringList processpaths; #if defined(Q_OS_OSX) partialPath = FS::PathCombine(QDir::homePath(), "Library/Application Support"); #elif defined(Q_OS_WIN32) partialPath = QProcessEnvironment::systemEnvironment().value("LOCALAPPDATA", ""); executable += "w.exe"; + + // add the following to the search + // C:\Users\USERNAME\AppData\Local\Packages\Microsoft.4297127D64EC6_8wekyb3d8bbwe\LocalCache\Local\runtime + auto minecraftInstaltionPath = + FS::PathCombine(QFileInfo(partialPath).absolutePath(), "Local", "Packages", "Microsoft.4297127D64EC6_8wekyb3d8bbwe"); + minecraftInstaltionPath = FS::PathCombine(minecraftInstaltionPath, "LocalCache", "Local", "runtime"); + processpaths << minecraftInstaltionPath; #else partialPath = QDir::homePath(); #endif - auto minecraftPath = FS::PathCombine(partialPath, ".minecraft", "runtime"); - QStringList javas; - QStringList processpaths{ minecraftPath }; + auto minecraftDataPath = FS::PathCombine(partialPath, ".minecraft", "runtime"); + processpaths << minecraftDataPath; + QStringList javas; while (!processpaths.isEmpty()) { auto dirPath = processpaths.takeFirst(); QDir dir(dirPath);