Compare commits
8 Commits
60030695b3
...
847106f1fb
Author | SHA1 | Date |
---|---|---|
Henry | 847106f1fb | |
Henry | 93f60488fa | |
Henry Le Grys | b5fe175650 | |
Henry Le Grys | 11808457fe | |
Ch. König | 5712eb1dfb | |
Ch. König | 9428dbbe7b | |
DaPorkchop_ | 5668e567a1 | |
DaPorkchop_ | 31a13115fb |
|
@ -194,9 +194,21 @@ public class Bootstrap {
|
|||
String osName = System.getProperty("os.name").toLowerCase();
|
||||
if (osName.contains("win")) {
|
||||
return new File(getFileChooseDefaultDir(), getProperties().getProperty("homeFolderWindows"));
|
||||
} else {
|
||||
return new File(System.getProperty("user.home"), getProperties().getProperty("homeFolder"));
|
||||
}
|
||||
|
||||
File dotFolder = new File(System.getProperty("user.home"), getProperties().getProperty("homeFolder"));
|
||||
String xdgFolderName = getProperties().getProperty("homeFolderLinux");
|
||||
|
||||
if (osName.contains("linux") && !dotFolder.exists() && !xdgFolderName.isEmpty()) {
|
||||
String xdgDataHome = System.getenv("XDG_DATA_HOME");
|
||||
if (xdgDataHome.isEmpty()) {
|
||||
xdgDataHome = System.getProperty("user.home") + "/.local/share";
|
||||
}
|
||||
|
||||
return new File(xdgDataHome, xdgFolderName);
|
||||
}
|
||||
|
||||
return dotFolder;
|
||||
}
|
||||
|
||||
private static boolean isPortableMode() {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#
|
||||
|
||||
homeFolderWindows=Example Launcher
|
||||
homeFolderLinux=example_launcher
|
||||
homeFolder=.examplelauncher
|
||||
launcherClass=com.skcraft.launcher.Launcher
|
||||
latestUrl=http://update.skcraft.com/quark/launcher/latest.json
|
|
@ -164,7 +164,7 @@ public class PackageBuilder {
|
|||
|
||||
if (basicProfile.isLegacy()) {
|
||||
processor = new OldForgeLoaderProcessor();
|
||||
} else if (basicProfile.getProfile().equalsIgnoreCase("forge")) {
|
||||
} else {
|
||||
processor = new ModernForgeLoaderProcessor();
|
||||
}
|
||||
} else if (BuilderUtils.getZipEntry(jarFile, "fabric-installer.json") != null) {
|
||||
|
|
|
@ -73,6 +73,12 @@ public class ModernForgeLoaderProcessor implements ILoaderProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
// Copy logging config
|
||||
SidedData<VersionManifest.LoggingConfig> loggingConfig = info.getLogging();
|
||||
if (loggingConfig != null) {
|
||||
version.setLogging(loggingConfig);
|
||||
}
|
||||
|
||||
// Copy main class
|
||||
String mainClass = info.getMainClass();
|
||||
if (mainClass != null) {
|
||||
|
@ -150,6 +156,22 @@ public class ModernForgeLoaderProcessor implements ILoaderProcessor {
|
|||
// Add loader manifest to the map
|
||||
manifest.getLoaders().put(loaderName, new LoaderManifest(profile.getLibraries(), profile.getData(), extraFiles));
|
||||
|
||||
// Find name of final patched library and mark it as excluded from download
|
||||
// TODO: we should generalize this to all process outputs, really
|
||||
SidedData<String> finalJars = profile.getData().get("PATCHED");
|
||||
if (finalJars != null) {
|
||||
String libraryName = finalJars.getClient();
|
||||
libraryName = libraryName.substring(1, libraryName.length() - 1);
|
||||
|
||||
for (Library lib : result.getLoaderLibraries()) {
|
||||
if (lib.matches(libraryName)) {
|
||||
lib.setGenerated(true);
|
||||
log.info(String.format("Setting generated flag on library '%s'", lib.getName()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add processors
|
||||
manifest.getTasks().addAll(profile.toProcessorEntries(loaderName));
|
||||
}
|
||||
|
|
|
@ -140,7 +140,6 @@ public class Runner implements Callable<Process>, ProgressObservable {
|
|||
}
|
||||
|
||||
progress = new DefaultProgress(0.9, SharedLocale.tr("runner.collectingArgs"));
|
||||
builder.classPath(getJarPath());
|
||||
builder.setMainClass(versionManifest.getMainClass());
|
||||
|
||||
addWindowArgs();
|
||||
|
@ -232,6 +231,9 @@ public class Runner implements Callable<Process>, ProgressObservable {
|
|||
tr("runner.missingLibrary", instance.getTitle(), library.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
// The official launcher puts the vanilla jar at the end of the classpath, we'll do the same
|
||||
builder.classPath(getJarPath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -307,7 +309,7 @@ public class Runner implements Callable<Process>, ProgressObservable {
|
|||
}
|
||||
}
|
||||
|
||||
if (versionManifest.getLogging() != null) {
|
||||
if (versionManifest.getLogging() != null && versionManifest.getLogging().getClient() != null) {
|
||||
log.info("Logging config present, log4j2 bug likely mitigated");
|
||||
|
||||
VersionManifest.LoggingConfig config = versionManifest.getLogging().getClient();
|
||||
|
|
|
@ -19,7 +19,7 @@ public class LoaderManifest {
|
|||
|
||||
public Library findLibrary(String name) {
|
||||
for (Library library : getLibraries()) {
|
||||
if (library.getName().equals(name)) {
|
||||
if (library.matches(name)) {
|
||||
return library;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.google.common.base.Splitter;
|
|||
import com.skcraft.launcher.model.minecraft.GameArgument;
|
||||
import com.skcraft.launcher.model.minecraft.Library;
|
||||
import com.skcraft.launcher.model.minecraft.MinecraftArguments;
|
||||
import com.skcraft.launcher.model.minecraft.VersionManifest;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -23,6 +24,7 @@ public class VersionInfo {
|
|||
private MinecraftArguments arguments;
|
||||
private String mainClass;
|
||||
private List<Library> libraries;
|
||||
private SidedData<VersionManifest.LoggingConfig> logging;
|
||||
|
||||
@JsonIgnore private transient boolean overridingArguments;
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ package com.skcraft.launcher.model.minecraft;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Lists;
|
||||
|
@ -33,7 +34,8 @@ public class Library {
|
|||
private String comment;
|
||||
|
||||
// Custom
|
||||
private boolean locallyAvailable;
|
||||
@JsonInclude(value = JsonInclude.Include.NON_DEFAULT)
|
||||
private boolean generated;
|
||||
|
||||
public boolean matches(Environment environment) {
|
||||
boolean allow = false;
|
||||
|
@ -201,6 +203,12 @@ public class Library {
|
|||
}
|
||||
|
||||
public void setName(String name) {
|
||||
int classifierPos = name.indexOf("@");
|
||||
if (classifierPos != -1) {
|
||||
// Take off classifiers
|
||||
name = name.substring(0, classifierPos);
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
|
||||
// [DEEP SIGH]
|
||||
|
@ -226,6 +234,20 @@ public class Library {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Classifier-independent library name check
|
||||
* @param mavenName Maven name of a library, possibly with a classifier
|
||||
* @return True if this library is named 'mavenName'.
|
||||
*/
|
||||
public boolean matches(String mavenName) {
|
||||
int classifierPos = mavenName.indexOf('@');
|
||||
if (classifierPos != -1) {
|
||||
mavenName = mavenName.substring(0, classifierPos);
|
||||
}
|
||||
|
||||
return this.name.equals(mavenName);
|
||||
}
|
||||
|
||||
public static String mavenNameToPath(String mavenName) {
|
||||
List<String> split = Splitter.on(':').splitToList(mavenName);
|
||||
int size = split.size();
|
||||
|
|
|
@ -249,6 +249,8 @@ public abstract class BaseUpdater {
|
|||
}
|
||||
|
||||
for (Library library : allLibraries) {
|
||||
if (library.isGenerated()) continue; // Skip generated libraries.
|
||||
|
||||
if (library.matches(environment)) {
|
||||
checkInterrupted();
|
||||
|
||||
|
@ -282,7 +284,7 @@ public abstract class BaseUpdater {
|
|||
}
|
||||
|
||||
// Use our custom logging config depending on what the manifest specifies
|
||||
if (versionManifest.getLogging() != null) {
|
||||
if (versionManifest.getLogging() != null && versionManifest.getLogging().getClient() != null) {
|
||||
VersionManifest.LoggingConfig config = versionManifest.getLogging().getClient();
|
||||
|
||||
VersionManifest.Artifact file = config.getFile();
|
||||
|
|
Loading…
Reference in New Issue