| 56 | } |
| 57 | |
| 58 | void LauncherPartLaunch::executeTask() |
| 59 | { |
| 60 | auto instance = m_parent->instance(); |
| 61 | std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance); |
| 62 | |
| 63 | m_launchScript = minecraftInstance->createLaunchScript(m_session, m_serverToJoin); |
| 64 | QStringList args = minecraftInstance->javaArguments(); |
| 65 | QString allArgs = args.join(", "); |
| 66 | emit logLine("Java Arguments:\n[" + m_parent->censorPrivateInfo(allArgs) + "]\n\n", MessageLevel::Launcher); |
| 67 | |
| 68 | auto javaPath = FS::ResolveExecutable(instance->settings()->get("JavaPath").toString()); |
| 69 | |
| 70 | m_process.setProcessEnvironment(instance->createEnvironment()); |
| 71 | |
| 72 | // make detachable - this will keep the process running even if the object is destroyed |
| 73 | m_process.setDetachable(true); |
| 74 | |
| 75 | auto classPath = minecraftInstance->getClassPath(); |
| 76 | classPath.prepend(FS::PathCombine(APPLICATION->getJarsPath(), "NewLaunch.jar")); |
| 77 | |
| 78 | auto natPath = minecraftInstance->getNativePath(); |
| 79 | #ifdef Q_OS_WIN |
| 80 | if (!fitsInLocal8bit(natPath)) |
| 81 | { |
| 82 | args << "-Djava.library.path=" + shortPathName(natPath); |
| 83 | } |
| 84 | else |
| 85 | { |
| 86 | args << "-Djava.library.path=" + natPath; |
| 87 | } |
| 88 | #else |
| 89 | args << "-Djava.library.path=" + natPath; |
| 90 | #endif |
| 91 | |
| 92 | args << "-cp"; |
| 93 | #ifdef Q_OS_WIN |
| 94 | QStringList processed; |
| 95 | for(auto & item: classPath) |
| 96 | { |
| 97 | if (!fitsInLocal8bit(item)) |
| 98 | { |
| 99 | processed << shortPathName(item); |
| 100 | } |
| 101 | else |
| 102 | { |
| 103 | processed << item; |
| 104 | } |
| 105 | } |
| 106 | args << processed.join(';'); |
| 107 | #else |
| 108 | args << classPath.join(':'); |
| 109 | #endif |
| 110 | args << "org.multimc.EntryPoint"; |
| 111 | |
| 112 | qDebug() << args.join(' '); |
| 113 | |
| 114 | QString wrapperCommandStr = instance->getWrapperCommand().trimmed(); |
| 115 | if(!wrapperCommandStr.isEmpty()) |
nothing calls this directly
no test coverage detected