mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-04-10 18:27:28 +03:00
[FEATURE] LauncherGuard module
This commit is contained in:
parent
06e9bc8578
commit
95da394a5d
2 changed files with 19 additions and 1 deletions
|
@ -31,6 +31,8 @@
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class ClientLauncherProcess {
|
public class ClientLauncherProcess {
|
||||||
|
|
||||||
|
public final List<String> pre = new LinkedList<>();
|
||||||
public final ClientParams params = new ClientParams();
|
public final ClientParams params = new ClientParams();
|
||||||
public final List<String> jvmArgs = new LinkedList<>();
|
public final List<String> jvmArgs = new LinkedList<>();
|
||||||
public final List<String> jvmModules = new LinkedList<>();
|
public final List<String> jvmModules = new LinkedList<>();
|
||||||
|
@ -134,7 +136,7 @@ private void applyClientProfile() {
|
||||||
public void start(boolean pipeOutput) throws IOException, InterruptedException {
|
public void start(boolean pipeOutput) throws IOException, InterruptedException {
|
||||||
if (isStarted) throw new IllegalStateException("Process already started");
|
if (isStarted) throw new IllegalStateException("Process already started");
|
||||||
LauncherEngine.modulesManager.invokeEvent(new ClientProcessBuilderPreLaunchEvent(this));
|
LauncherEngine.modulesManager.invokeEvent(new ClientProcessBuilderPreLaunchEvent(this));
|
||||||
List<String> processArgs = new LinkedList<>();
|
List<String> processArgs = new LinkedList<>(pre);
|
||||||
processArgs.add(executeFile.toString());
|
processArgs.add(executeFile.toString());
|
||||||
processArgs.addAll(jvmArgs);
|
processArgs.addAll(jvmArgs);
|
||||||
if (javaVersion.version >= 9) {
|
if (javaVersion.version >= 9) {
|
||||||
|
|
|
@ -112,6 +112,22 @@ public static Path getGuardDir() {
|
||||||
return dir.resolve("guard");
|
return dir.resolve("guard");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Path getGuardDir(JVMHelper.ARCH arch, JVMHelper.OS os) {
|
||||||
|
Path dir = getGuardDir().resolve(makeSpecialGuardDirName(arch, os));
|
||||||
|
try {
|
||||||
|
IOHelper.createParentDirs(dir);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static String makeSpecialGuardDirName(JVMHelper.ARCH arch, JVMHelper.OS os) {
|
||||||
|
return String.format("%s-%s", arch.name, os.name);
|
||||||
|
}
|
||||||
|
|
||||||
public static Path getLegacyLauncherDir(String projectname) {
|
public static Path getLegacyLauncherDir(String projectname) {
|
||||||
return IOHelper.HOME_DIR.resolve(projectname);
|
return IOHelper.HOME_DIR.resolve(projectname);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue