Moved the creation of natives folder in ExtractNatives task
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
450b73328e
commit
8ecab305ac
@ -79,6 +79,7 @@ void ExtractNatives::executeTask()
|
|||||||
auto settings = minecraftInstance->settings();
|
auto settings = minecraftInstance->settings();
|
||||||
|
|
||||||
auto outputPath = minecraftInstance->getNativePath();
|
auto outputPath = minecraftInstance->getNativePath();
|
||||||
|
FS::ensureFolderPathExists(outputPath);
|
||||||
auto javaVersion = minecraftInstance->getJavaVersion();
|
auto javaVersion = minecraftInstance->getJavaVersion();
|
||||||
bool jniHackEnabled = javaVersion.major() >= 8;
|
bool jniHackEnabled = javaVersion.major() >= 8;
|
||||||
for (const auto& source : toExtract) {
|
for (const auto& source : toExtract) {
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <launch/LaunchStep.h>
|
#include <launch/LaunchStep.h>
|
||||||
#include <memory>
|
|
||||||
#include "minecraft/auth/AuthSession.h"
|
|
||||||
|
|
||||||
// FIXME: temporary wrapper for existing task.
|
// FIXME: temporary wrapper for existing task.
|
||||||
class ExtractNatives : public LaunchStep {
|
class ExtractNatives : public LaunchStep {
|
||||||
|
@ -88,20 +88,15 @@ QString shortPathName(const QString& file)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getShortPathName(const QString& file)
|
QString getPathNameInLocal8bit(const QString& file)
|
||||||
{
|
{
|
||||||
auto path = shortPathName(file);
|
if (!fitsInLocal8bit(file)) {
|
||||||
if (!path.isEmpty())
|
auto path = shortPathName(file);
|
||||||
return path;
|
if (!path.isEmpty()) {
|
||||||
// the path can not be getted due to the file/folder not existing
|
return path;
|
||||||
// so create the parrent folder
|
}
|
||||||
// and assume that we can concatenate the short path of the parent folder with the file name
|
// in case shortPathName fails just return the path as is
|
||||||
// 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());
|
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -156,24 +151,15 @@ void LauncherPartLaunch::executeTask()
|
|||||||
|
|
||||||
auto natPath = minecraftInstance->getNativePath();
|
auto natPath = minecraftInstance->getNativePath();
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
if (!fitsInLocal8bit(natPath)) {
|
natPath = getPathNameInLocal8bit(natPath);
|
||||||
args << "-Djava.library.path=" + getShortPathName(natPath);
|
|
||||||
} else {
|
|
||||||
args << "-Djava.library.path=" + natPath;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
args << "-Djava.library.path=" + natPath;
|
|
||||||
#endif
|
#endif
|
||||||
|
args << "-Djava.library.path=" + natPath;
|
||||||
|
|
||||||
args << "-cp";
|
args << "-cp";
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QStringList processed;
|
QStringList processed;
|
||||||
for (auto& item : classPath) {
|
for (auto& item : classPath) {
|
||||||
if (!fitsInLocal8bit(item)) {
|
processed << getPathNameInLocal8bit(item);
|
||||||
processed << getShortPathName(item);
|
|
||||||
} else {
|
|
||||||
processed << item;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
args << processed.join(';');
|
args << processed.join(';');
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user