Fixed windows appdata path

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2024-04-23 18:59:31 +03:00
parent dbfd535b38
commit dac7027846
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318

View File

@ -446,16 +446,16 @@ QStringList getMinecraftJavaBundle()
#if defined(Q_OS_OSX) #if defined(Q_OS_OSX)
processpaths << FS::PathCombine(QDir::homePath(), FS::PathCombine("Library", "Application Support", "minecraft", "runtime")); processpaths << FS::PathCombine(QDir::homePath(), FS::PathCombine("Library", "Application Support", "minecraft", "runtime"));
#elif defined(Q_OS_WIN32) #elif defined(Q_OS_WIN32)
QString partialPath = QProcessEnvironment::systemEnvironment().value("LOCALAPPDATA", ""); auto appDataPath = QProcessEnvironment::systemEnvironment().value("AppData", "");
processpaths << FS::PathCombine(partialPath, ".minecraft", "runtime"); processpaths << FS::PathCombine(QFileInfo(appDataPath).absolutePath(), ".minecraft", "runtime");
executable += "w.exe"; executable += "w.exe";
// add the microsoft store version of the launcher to the search. the current path is: // add the microsoft store version of the launcher to the search. the current path is:
// C:\Users\USERNAME\AppData\Local\Packages\Microsoft.4297127D64EC6_8wekyb3d8bbwe\LocalCache\Local\runtime // C:\Users\USERNAME\AppData\Local\Packages\Microsoft.4297127D64EC6_8wekyb3d8bbwe\LocalCache\Local\runtime
auto localAppDataPath = QProcessEnvironment::systemEnvironment().value("LOCALAPPDATA", "");
auto minecraftMSStorePath = auto minecraftMSStorePath =
FS::PathCombine(QFileInfo(partialPath).absolutePath(), "Local", "Packages", "Microsoft.4297127D64EC6_8wekyb3d8bbwe"); FS::PathCombine(QFileInfo(localAppDataPath).absolutePath(), "Local", "Packages", "Microsoft.4297127D64EC6_8wekyb3d8bbwe");
minecraftMSStorePath = FS::PathCombine(minecraftMSStorePath, "LocalCache", "Local", "runtime"); processpaths << FS::PathCombine(minecraftMSStorePath, "LocalCache", "Local", "runtime");
processpaths << minecraftMSStorePath;
#else #else
processpaths << FS::PathCombine(QDir::homePath(), ".minecraft", "runtime"); processpaths << FS::PathCombine(QDir::homePath(), ".minecraft", "runtime");
#endif #endif