diff --git a/launcher/minecraft/launch/ExtractNatives.cpp b/launcher/minecraft/launch/ExtractNatives.cpp index 8f3cac4d1..405008f40 100644 --- a/launcher/minecraft/launch/ExtractNatives.cpp +++ b/launcher/minecraft/launch/ExtractNatives.cpp @@ -79,6 +79,7 @@ void ExtractNatives::executeTask() auto settings = minecraftInstance->settings(); auto outputPath = minecraftInstance->getNativePath(); + FS::ensureFolderPathExists(outputPath); auto javaVersion = minecraftInstance->getJavaVersion(); bool jniHackEnabled = javaVersion.major() >= 8; for (const auto& source : toExtract) { diff --git a/launcher/minecraft/launch/ExtractNatives.h b/launcher/minecraft/launch/ExtractNatives.h index 2ab8816bd..4837a9dbb 100644 --- a/launcher/minecraft/launch/ExtractNatives.h +++ b/launcher/minecraft/launch/ExtractNatives.h @@ -16,8 +16,6 @@ #pragma once #include -#include -#include "minecraft/auth/AuthSession.h" // FIXME: temporary wrapper for existing task. class ExtractNatives : public LaunchStep { diff --git a/launcher/minecraft/launch/LauncherPartLaunch.cpp b/launcher/minecraft/launch/LauncherPartLaunch.cpp index dcfb3d148..3662f2bb6 100644 --- a/launcher/minecraft/launch/LauncherPartLaunch.cpp +++ b/launcher/minecraft/launch/LauncherPartLaunch.cpp @@ -88,20 +88,15 @@ QString shortPathName(const QString& file) return ret; } -QString getShortPathName(const QString& file) +QString getPathNameInLocal8bit(const QString& file) { - auto path = shortPathName(file); - if (!path.isEmpty()) - return path; - // the path can not be getted due to the file/folder not existing - // so create the parrent folder - // and assume that we can concatenate the short path of the parent folder with the file name - // usually the 8 bit characters are in the instance name not in the name of the end files/folders we need - FS::ensureFilePathExists(file); - QFileInfo a(file); - auto partialShortPath = shortPathName(a.path()); - if (!partialShortPath.isEmpty()) - return FS::PathCombine(partialShortPath, a.fileName()); + if (!fitsInLocal8bit(file)) { + auto path = shortPathName(file); + if (!path.isEmpty()) { + return path; + } + // in case shortPathName fails just return the path as is + } return file; } #endif @@ -156,24 +151,15 @@ void LauncherPartLaunch::executeTask() auto natPath = minecraftInstance->getNativePath(); #ifdef Q_OS_WIN - if (!fitsInLocal8bit(natPath)) { - args << "-Djava.library.path=" + getShortPathName(natPath); - } else { - args << "-Djava.library.path=" + natPath; - } -#else - args << "-Djava.library.path=" + natPath; + natPath = getPathNameInLocal8bit(natPath); #endif + args << "-Djava.library.path=" + natPath; args << "-cp"; #ifdef Q_OS_WIN QStringList processed; for (auto& item : classPath) { - if (!fitsInLocal8bit(item)) { - processed << getShortPathName(item); - } else { - processed << item; - } + processed << getPathNameInLocal8bit(item); } args << processed.join(';'); #else