Add extra step to macos java install

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2024-09-14 21:18:20 +03:00
parent 6492ad7076
commit 0afdce8a31
5 changed files with 136 additions and 0 deletions

View File

@ -41,6 +41,7 @@
#include "Application.h"
#include "FileSystem.h"
#include "MessageLevel.h"
#include "QObjectPtr.h"
#include "SysInfo.h"
#include "java/JavaInstall.h"
#include "java/JavaInstallList.h"
@ -48,10 +49,12 @@
#include "java/JavaVersion.h"
#include "java/download/ArchiveDownloadTask.h"
#include "java/download/ManifestDownloadTask.h"
#include "java/download/SymlinkTask.h"
#include "meta/Index.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/PackProfile.h"
#include "net/Mode.h"
#include "tasks/SequentialTask.h"
AutoInstallJava::AutoInstallJava(LaunchTask* parent)
: LaunchStep(parent)
@ -175,6 +178,12 @@ void AutoInstallJava::downloadJava(Meta::Version::Ptr version, QString javaName)
emitFailed(tr("Could not determine Java download type!"));
return;
}
#if defined(Q_OS_MACOS)
auto seq = makeShared<SequentialTask>(this, tr("Install Java"));
seq->addTask(m_current_task);
seq->addTask(makeShared<Java::SymlinkTask>(final_path));
m_current_task = seq;
#endif
auto deletePath = [final_path] { FS::deletePath(final_path); };
connect(m_current_task.get(), &Task::failed, this, [this, deletePath](QString reason) {
deletePath();