From 877de6da40ab7fc0f06cf1e720e43fde56194d3f Mon Sep 17 00:00:00 2001 From: Trial97 Date: Tue, 23 Apr 2024 18:59:31 +0300 Subject: [PATCH] Fixed windows appdata path Signed-off-by: Trial97 (cherry picked from commit dac70278462913b7c0191c56a04e62529d5c774b) --- launcher/java/JavaUtils.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/launcher/java/JavaUtils.cpp b/launcher/java/JavaUtils.cpp index 35d9ec610..d1d58b0cf 100644 --- a/launcher/java/JavaUtils.cpp +++ b/launcher/java/JavaUtils.cpp @@ -446,16 +446,16 @@ QStringList getMinecraftJavaBundle() #if defined(Q_OS_OSX) processpaths << FS::PathCombine(QDir::homePath(), FS::PathCombine("Library", "Application Support", "minecraft", "runtime")); #elif defined(Q_OS_WIN32) - QString partialPath = QProcessEnvironment::systemEnvironment().value("LOCALAPPDATA", ""); - processpaths << FS::PathCombine(partialPath, ".minecraft", "runtime"); + auto appDataPath = QProcessEnvironment::systemEnvironment().value("AppData", ""); + processpaths << FS::PathCombine(QFileInfo(appDataPath).absolutePath(), ".minecraft", "runtime"); executable += "w.exe"; // 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 + auto localAppDataPath = QProcessEnvironment::systemEnvironment().value("LOCALAPPDATA", ""); auto minecraftMSStorePath = - FS::PathCombine(QFileInfo(partialPath).absolutePath(), "Local", "Packages", "Microsoft.4297127D64EC6_8wekyb3d8bbwe"); - minecraftMSStorePath = FS::PathCombine(minecraftMSStorePath, "LocalCache", "Local", "runtime"); - processpaths << minecraftMSStorePath; + FS::PathCombine(QFileInfo(localAppDataPath).absolutePath(), "Local", "Packages", "Microsoft.4297127D64EC6_8wekyb3d8bbwe"); + processpaths << FS::PathCombine(minecraftMSStorePath, "LocalCache", "Local", "runtime"); #else processpaths << FS::PathCombine(QDir::homePath(), ".minecraft", "runtime"); #endif