Several fixes

This commit is contained in:
JFronny 2021-11-11 20:42:22 +01:00
parent 80b960a8c9
commit 7a920d3218
No known key found for this signature in database
GPG Key ID: BEC5ACBBD4EE17E5
5 changed files with 15 additions and 8 deletions

View File

@ -87,7 +87,7 @@ public class Inceptum {
Inceptum.LOGGER.info("Force-Loading libraries:");
Utils.ls(FORCE_LOAD_PATH, path -> {
Inceptum.LOGGER.info("Loading " + path);
System.load(path.toString());
System.load(path.toAbsolutePath().toString());
});
}

View File

@ -50,7 +50,7 @@ public class Utils {
}
private static <T> T downloadObject(String url, ThrowingSupplier<String, IOException> sourceString, Function<String, T> builder) throws IOException {
Path cache = Inceptum.CACHE_DIR.resolve(Integer.toString(url.hashCode()));
Path cache = Inceptum.CACHE_DIR.resolve(HashUtils.sha1(url.getBytes(StandardCharsets.UTF_8)));
if (Files.exists(cache))
return builder.apply(Files.readString(cache));
try {

View File

@ -41,7 +41,7 @@ public class MainWindow extends Window {
if (ImGui.menuItem("Re-download resources")) {
try {
Utils.clearDirectory(Inceptum.ASSETS_DIR);
Utils.clearDirectory(Inceptum.LIBRARIES_DIR);
Utils.clearDirectory(Inceptum.LIBRARIES_DIR, path -> !path.startsWith(Inceptum.LIBRARIES_DIR.resolve("io/gitlab/jfronny")));
Utils.clearDirectory(Inceptum.NATIVES_DIR, path -> !path.endsWith("forceload"));
Utils.clearDirectory(Inceptum.CACHE_DIR);
Steps.reDownload();

View File

@ -37,9 +37,11 @@ public class InstanceManageControls {
public InstanceManageControls(InstanceMeta meta) {
selected = getVersions(false).get(0);
for (VersionsListInfo ver : getVersions(true)) {
if (ver.id.equals(meta.getMinecraftVersion()))
selected = ver;
if (meta != null) {
for (VersionsListInfo ver : getVersions(true)) {
if (ver.id.equals(meta.getMinecraftVersion()))
selected = ver;
}
}
version.set(getVersions(snapshots.get()).indexOf(selected));
name.set(getDefaultName(selected, fabric.get()));

View File

@ -24,16 +24,21 @@ public class UpdateChecker {
}
GitlabProject project = GitlabApi.getProject(PROJECT_ID);
PackageInfo experimental = null;
ComparableVersion experimentalVersion = null;
PackageInfo stable = null;
ComparableVersion stableVersion = null;
for (PackageInfo info : GitlabApi.getPackages(project)) {
if (info.status.equals("default")) {
for (Pipeline pipeline : info.pipelines) {
if (pipeline.ref.equals("master") && pipeline.status.equals("success")) {
if (experimental == null || experimental.created_at.compareTo(pipeline.created_at) < 0) {
ComparableVersion cvNew = new ComparableVersion(info.version);
if (experimentalVersion == null || experimentalVersion.compareTo(cvNew) < 0) {
experimental = info;
experimentalVersion = cvNew;
}
if (!info.version.contains("+") && (stable == null || stable.created_at.compareTo(pipeline.created_at) < 0)) {
if (!info.version.contains("+") && (stableVersion == null || stableVersion.compareTo(cvNew) < 0)) {
stable = info;
stableVersion = cvNew;
}
}
}