Inceptum/wrapper/src/main/java/io/gitlab/jfronny/inceptum/wrapper/Wrapper.java

38 lines
1.8 KiB
Java
Raw Normal View History

package io.gitlab.jfronny.inceptum.wrapper;
import gsoncompile.extensions.io.gitlab.jfronny.inceptum.common.model.inceptum.WrapperConfig.GC_WrapperConfig;
import io.gitlab.jfronny.commons.ref.R;
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.*;
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;
public class Wrapper {
public static void main(String[] args) throws IOException, URISyntaxException, Updater.UpdateCheckException {
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);
InceptumEnvironmentInitializer.initialize();
2022-09-06 11:15:21 +02:00
if (!Files.exists(MetaHolder.WRAPPER_CONFIG_PATH)) {
UpdateMetadata update = Updater.check(UpdateChannel.Stable, false, true, 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);
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.");
}
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));
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
}
}