| 69 | } |
| 70 | |
| 71 | void LauncherPartLaunch::executeTask() |
| 72 | { |
| 73 | QString jarPath = APPLICATION->getJarPath("NewLaunch.jar"); |
| 74 | if (jarPath.isEmpty()) { |
| 75 | const char* reason = QT_TR_NOOP("Launcher library could not be found. Please check your installation."); |
| 76 | emit logLine(tr(reason), MessageLevel::Fatal); |
| 77 | emitFailed(tr(reason)); |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | auto instance = m_parent->instance(); |
| 82 | |
| 83 | QString legacyJarPath; |
| 84 | if (instance->getLauncher() == "legacy" || instance->shouldApplyOnlineFixes()) { |
| 85 | legacyJarPath = APPLICATION->getJarPath("NewLaunchLegacy.jar"); |
| 86 | if (legacyJarPath.isEmpty()) { |
| 87 | const char* reason = QT_TR_NOOP("Legacy launcher library could not be found. Please check your installation."); |
| 88 | emit logLine(tr(reason), MessageLevel::Fatal); |
| 89 | emitFailed(tr(reason)); |
| 90 | return; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | m_launchScript = instance->createLaunchScript(m_session, m_targetToJoin); |
| 95 | QStringList args = instance->javaArguments(); |
| 96 | QString allArgs = args.join(", "); |
| 97 | emit logLine("Java Arguments:\n[" + m_parent->censorPrivateInfo(allArgs) + "]\n\n", MessageLevel::Launcher); |
| 98 | |
| 99 | auto javaPath = FS::ResolveExecutable(instance->settings()->get("JavaPath").toString()); |
| 100 | |
| 101 | m_process.setProcessEnvironment(instance->createLaunchEnvironment()); |
| 102 | |
| 103 | // make detachable - this will keep the process running even if the object is destroyed |
| 104 | m_process.setDetachable(true); |
| 105 | |
| 106 | auto classPath = instance->getClassPath(); |
| 107 | classPath.prepend(jarPath); |
| 108 | |
| 109 | if (!legacyJarPath.isEmpty()) |
| 110 | classPath.prepend(legacyJarPath); |
| 111 | |
| 112 | auto natPath = instance->getNativePath(); |
| 113 | #ifdef Q_OS_WIN |
| 114 | natPath = FS::getPathNameInLocal8bit(natPath); |
| 115 | #endif |
| 116 | args << "-Djava.library.path=" + natPath; |
| 117 | |
| 118 | args << "-cp"; |
| 119 | #ifdef Q_OS_WIN |
| 120 | QStringList processed; |
| 121 | for (auto& item : classPath) { |
| 122 | processed << FS::getPathNameInLocal8bit(item); |
| 123 | } |
| 124 | args << processed.join(';'); |
| 125 | #else |
| 126 | args << classPath.join(':'); |
| 127 | #endif |
| 128 | args << "org.prismlauncher.EntryPoint"; |
nothing calls this directly
no test coverage detected