Fix general tab for showing wrong instance name
This commit is contained in:
parent
85d7a6a90f
commit
572943ead0
|
@ -69,6 +69,7 @@ dependencies {
|
|||
implementation "ch.qos.logback:logback-classic:$logbackVersion"
|
||||
implementation "io.gitlab.jfronny:commons:$jfCommonsVersion"
|
||||
implementation "io.gitlab.jfronny:commons-gson:$jfCommonsVersion"
|
||||
implementation "io.gitlab.jfronny:commons-slf4j:$jfCommonsVersion"
|
||||
implementation "org.eclipse.jgit:org.eclipse.jgit:$jgitVersion"
|
||||
implementation project(":wrapper")
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class InstanceManageControls {
|
|||
private VersionsListInfo selected;
|
||||
private FabricVersionLoaderInfo selectedFabric;
|
||||
|
||||
public InstanceManageControls(InstanceMeta meta) {
|
||||
public InstanceManageControls(InstanceMeta meta, String defaultName) {
|
||||
selected = getVersions(false).get(0);
|
||||
if (meta != null) {
|
||||
for (VersionsListInfo ver : getVersions(true)) {
|
||||
|
@ -48,7 +48,7 @@ public class InstanceManageControls {
|
|||
}
|
||||
}
|
||||
version.set(getVersions(snapshots.get()).indexOf(selected));
|
||||
name.set(getDefaultName(selected, fabric.get()));
|
||||
name.set(defaultName == null ? getDefaultName(selected, fabric.get()) : defaultName);
|
||||
fabric.set(meta == null || meta.isFabric());
|
||||
List<FabricVersionLoaderInfo> versions = getFabricLoaderInfo();
|
||||
for (int i = 0, fabricLoaderInfoSize = versions.size(); i < fabricLoaderInfoSize; i++) {
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.io.IOException;
|
|||
import java.net.URISyntaxException;
|
||||
|
||||
public class NewInstanceWindow extends Window {
|
||||
private final InstanceManageControls imc = new InstanceManageControls(null);
|
||||
private final InstanceManageControls imc = new InstanceManageControls(null, null);
|
||||
private final ImString inceptumRepo = new ImString(GuiUtil.INPUT_FIELD_LENGTH);
|
||||
private final ImString inceptumName = new ImString(GuiUtil.INPUT_FIELD_LENGTH);
|
||||
private String inceptumNamePrev = "";
|
||||
|
|
|
@ -25,7 +25,7 @@ public class GeneralTab extends Tab {
|
|||
public GeneralTab(InstanceEditWindow window) {
|
||||
super("General");
|
||||
this.window = window;
|
||||
imc = new InstanceManageControls(window.instance);
|
||||
imc = new InstanceManageControls(window.instance, window.name);
|
||||
customJava = new ImBoolean(window.instance.java != null);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.gitlab.jfronny.inceptum.util;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.*;
|
||||
|
||||
public class PathUtil {
|
||||
public static final String EXT_DISABLED = ".disabled";
|
||||
|
@ -24,6 +24,15 @@ public class PathUtil {
|
|||
return p.getParent().resolve(fileName);
|
||||
}
|
||||
|
||||
public static boolean hasImod(Path mod) {
|
||||
Path parent = mod.getParent();
|
||||
if (parent == null) {
|
||||
Utils.LOGGER.info("The mod file " + mod + " doesn't have a parent. What is happening here?");
|
||||
return false;
|
||||
}
|
||||
return Files.exists(appendImod(mod));
|
||||
}
|
||||
|
||||
public static Path appendImod(Path p) {
|
||||
return p.getParent().resolve(fn(p) + EXT_IMOD);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public record IWModDescription(Path path, Optional<ModDescription> mod, Optional
|
|||
this(path,
|
||||
Files.isDirectory(path) ? Optional.empty() : Optional.of(ModDescription.of(path)),
|
||||
Optional.empty(),
|
||||
Files.exists(PathUtil.appendImod(path)) ? Optional.of(PathUtil.appendImod(path)) : Optional.empty());
|
||||
PathUtil.hasImod(path) ? Optional.of(PathUtil.appendImod(path)) : Optional.empty());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ dependencies {
|
|||
implementation "ch.qos.logback:logback-classic:${rootProject.logbackVersion}"
|
||||
implementation "io.gitlab.jfronny:commons:${rootProject.jfCommonsVersion}"
|
||||
implementation "io.gitlab.jfronny:commons-gson:${rootProject.jfCommonsVersion}"
|
||||
implementation "io.gitlab.jfronny:commons-slf4j:${rootProject.jfCommonsVersion}"
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package io.gitlab.jfronny.inceptum.util;
|
||||
|
||||
import io.gitlab.jfronny.commons.*;
|
||||
import io.gitlab.jfronny.commons.log.*;
|
||||
import io.gitlab.jfronny.commons.serialize.gson.api.*;
|
||||
import io.gitlab.jfronny.commons.throwable.*;
|
||||
import io.gitlab.jfronny.inceptum.*;
|
||||
import io.gitlab.jfronny.inceptum.util.cache.*;
|
||||
import org.slf4j.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
|
@ -23,7 +23,7 @@ import java.util.stream.*;
|
|||
|
||||
public class Utils {
|
||||
public static final Pattern VALID_FILENAME = Pattern.compile("[a-zA-Z0-9_\\-.][a-zA-Z0-9 _\\-.]*[a-zA-Z0-9_\\-.]");
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger("Inceptum");
|
||||
public static final Logger LOGGER = Logger.forName("Inceptum");
|
||||
private static final GsonFileCache OBJECT_CACHE = new GsonFileCache(MetaHolder.CACHE_DIR);
|
||||
|
||||
public static byte[] downloadData(String url) throws IOException, URISyntaxException {
|
||||
|
|
Loading…
Reference in New Issue