36 lines
1.6 KiB
Java
36 lines
1.6 KiB
Java
package io.gitlab.jfronny.inceptum.wrapper;
|
|
|
|
import io.gitlab.jfronny.inceptum.common.*;
|
|
import io.gitlab.jfronny.inceptum.common.model.inceptum.*;
|
|
|
|
import java.io.*;
|
|
import java.net.URISyntaxException;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Path;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class Wrapper {
|
|
public static void main(String[] args) throws IOException, URISyntaxException {
|
|
System.out.println("Inceptum Wrapper v" + BuildMetadata.VERSION);
|
|
System.out.println("Loading from " + MetaHolder.BASE_PATH);
|
|
InceptumEnvironmentInitializer.initialize();
|
|
if (!Files.exists(MetaHolder.WRAPPER_CONFIG_PATH)) {
|
|
UpdateMetadata update = Updater.check(UpdateChannel.Stable, false, R::nop);
|
|
if (update == null) {
|
|
throw new FileNotFoundException("Could not identify a valid inceptum version. Are you connected to the internet?");
|
|
}
|
|
Updater.update(update, false);
|
|
if (!Files.exists(MetaHolder.WRAPPER_CONFIG_PATH)) {
|
|
throw new FileNotFoundException("Something went wrong while downloading the latest version.");
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|