2022-09-06 21:20:59 +02:00
|
|
|
package io.gitlab.jfronny.inceptum.wrapper;
|
2021-10-31 16:59:25 +01:00
|
|
|
|
2022-09-04 21:21:24 +02:00
|
|
|
import io.gitlab.jfronny.inceptum.common.*;
|
2022-09-06 11:15:21 +02:00
|
|
|
import io.gitlab.jfronny.inceptum.common.model.inceptum.*;
|
2021-10-31 16:59:25 +01:00
|
|
|
|
2022-09-06 13:28:28 +02:00
|
|
|
import java.io.*;
|
2022-09-04 21:21:24 +02:00
|
|
|
import java.net.URISyntaxException;
|
|
|
|
import java.nio.file.Files;
|
|
|
|
import java.nio.file.Path;
|
2022-09-06 11:15:21 +02:00
|
|
|
import java.util.List;
|
2022-09-06 13:28:28 +02:00
|
|
|
import java.util.stream.Collectors;
|
2021-10-31 16:59:25 +01:00
|
|
|
|
|
|
|
public class Wrapper {
|
2022-09-06 21:20:59 +02:00
|
|
|
public static void main(String[] args) throws IOException, URISyntaxException {
|
2022-09-04 21:21:24 +02:00
|
|
|
System.out.println("Inceptum Wrapper v" + BuildMetadata.VERSION);
|
2022-09-06 13:28:28 +02:00
|
|
|
System.out.println("Loading from " + MetaHolder.BASE_PATH);
|
2022-07-04 13:22:28 +02:00
|
|
|
InceptumEnvironmentInitializer.initialize();
|
2022-09-06 11:15:21 +02:00
|
|
|
if (!Files.exists(MetaHolder.WRAPPER_CONFIG_PATH)) {
|
2022-11-03 17:07:55 +01:00
|
|
|
UpdateMetadata update = Updater.check(UpdateChannel.Stable, false, R::nop);
|
2022-09-06 11:15:21 +02:00
|
|
|
if (update == null) {
|
|
|
|
throw new FileNotFoundException("Could not identify a valid inceptum version. Are you connected to the internet?");
|
2021-12-08 20:38:28 +01:00
|
|
|
}
|
2022-09-06 11:15:21 +02:00
|
|
|
Updater.update(update, false);
|
2022-09-06 21:20:59 +02:00
|
|
|
if (!Files.exists(MetaHolder.WRAPPER_CONFIG_PATH)) {
|
2022-09-06 11:15:21 +02:00
|
|
|
throw new FileNotFoundException("Something went wrong while downloading the latest version.");
|
2022-09-06 21:20:59 +02:00
|
|
|
}
|
2021-12-08 20:38:28 +01:00
|
|
|
}
|
2022-11-02 00:38:04 +01:00
|
|
|
List<Path> classpath = Updater.getLaunchClasspath(GC_WrapperConfig.read(MetaHolder.WRAPPER_CONFIG_PATH));
|
2022-09-06 21:20:59 +02:00
|
|
|
if (!BuildMetadata.IS_RELEASE) {
|
|
|
|
System.out.println("Using classpath: " + classpath.stream().map(Path::toString).collect(Collectors.joining("" + File.pathSeparator)));
|
|
|
|
}
|
|
|
|
System.out.println("Starting Inceptum ClassLoader");
|
|
|
|
RuntimeEnv.start(classpath, "io.gitlab.jfronny.inceptum.Inceptum", args);
|
2021-12-08 20:38:28 +01:00
|
|
|
}
|
2021-10-31 16:59:25 +01:00
|
|
|
}
|