fix: installer trying to download & install libraries it shouldnt
This commit is contained in:
parent
d959985ffc
commit
ab9040d2a4
3 changed files with 34 additions and 27 deletions
2
.vscode/snippets/java.json
vendored
2
.vscode/snippets/java.json
vendored
|
@ -2,7 +2,7 @@
|
|||
"LogManager_Log": {
|
||||
"prefix": "logmanager",
|
||||
"body": [
|
||||
"LogManager.${1|debug,warn,logStackTrace,info,error|}(${2:\"Test\"});"
|
||||
"LogManager.${1|debug,debugObject,warn,logStackTrace,info,error|}(${2:\"Test\"});"
|
||||
],
|
||||
"description": "Log a debug message to the ATLauncher console"
|
||||
}
|
||||
|
|
|
@ -53,6 +53,10 @@ public final class LogManager {
|
|||
debug(message, false);
|
||||
}
|
||||
|
||||
public static void debugObject(Object object) {
|
||||
debug(Gsons.DEFAULT.toJson(object), false);
|
||||
}
|
||||
|
||||
public static void debug(String message, boolean force) {
|
||||
if (showDebug || force) {
|
||||
queue.offer(new LogEvent(LogType.DEBUG, message));
|
||||
|
|
|
@ -627,17 +627,18 @@ public class NewInstanceInstaller extends InstanceInstaller {
|
|||
}
|
||||
|
||||
private List<Downloadable> getDownloadableLibraries() {
|
||||
return this.getLibraries().stream().map(library -> {
|
||||
if (library instanceof ForgeLibrary && ((ForgeLibrary) library).isUsingPackXz()) {
|
||||
return new ForgeXzDownloadable(library.downloads.artifact.url,
|
||||
new File(App.settings.getGameLibrariesDir(), library.downloads.artifact.path),
|
||||
library.downloads.artifact.sha1, library.downloads.artifact.size, this, null);
|
||||
}
|
||||
return this.getLibraries().stream()
|
||||
.filter(library -> library.shouldInstall() && library.downloads.artifact != null).map(library -> {
|
||||
if (library instanceof ForgeLibrary && ((ForgeLibrary) library).isUsingPackXz()) {
|
||||
return new ForgeXzDownloadable(library.downloads.artifact.url,
|
||||
new File(App.settings.getGameLibrariesDir(), library.downloads.artifact.path),
|
||||
library.downloads.artifact.sha1, library.downloads.artifact.size, this, null);
|
||||
}
|
||||
|
||||
return new Downloadable(library.downloads.artifact.url,
|
||||
new File(App.settings.getGameLibrariesDir(), library.downloads.artifact.path),
|
||||
library.downloads.artifact.sha1, library.downloads.artifact.size, this, false);
|
||||
}).collect(Collectors.toList());
|
||||
return new Downloadable(library.downloads.artifact.url,
|
||||
new File(App.settings.getGameLibrariesDir(), library.downloads.artifact.path),
|
||||
library.downloads.artifact.sha1, library.downloads.artifact.size, this, false);
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<Downloadable> getDownloadableNativeLibraries() {
|
||||
|
@ -654,29 +655,31 @@ public class NewInstanceInstaller extends InstanceInstaller {
|
|||
fireTask(Language.INSTANCE.localize("instance.organisinglibraries"));
|
||||
fireSubProgressUnknown();
|
||||
|
||||
this.getLibraries().stream().forEach(library -> {
|
||||
File libraryFile = new File(App.settings.getGameLibrariesDir(), library.downloads.artifact.path);
|
||||
this.getLibraries().stream().filter(library -> library.shouldInstall() && library.downloads.artifact != null)
|
||||
.forEach(library -> {
|
||||
File libraryFile = new File(App.settings.getGameLibrariesDir(), library.downloads.artifact.path);
|
||||
|
||||
if (isServer) {
|
||||
File serverFile = new File(getLibrariesDirectory(), library.downloads.artifact.path);
|
||||
if (isServer) {
|
||||
File serverFile = new File(getLibrariesDirectory(), library.downloads.artifact.path);
|
||||
|
||||
serverFile.getParentFile().mkdirs();
|
||||
serverFile.getParentFile().mkdirs();
|
||||
|
||||
Utils.copyFile(libraryFile, serverFile, true);
|
||||
} else if (library.hasNativeForOS()) {
|
||||
File nativeFile = new File(App.settings.getGameLibrariesDir(), library.getNativeDownloadForOS().path);
|
||||
Utils.copyFile(libraryFile, serverFile, true);
|
||||
} else if (library.hasNativeForOS()) {
|
||||
File nativeFile = new File(App.settings.getGameLibrariesDir(),
|
||||
library.getNativeDownloadForOS().path);
|
||||
|
||||
ZipUtil.unpack(nativeFile, this.getNativesDirectory(), new NameMapper() {
|
||||
public String map(String name) {
|
||||
if (library.extract != null && library.extract.shouldExclude(name)) {
|
||||
return null;
|
||||
}
|
||||
ZipUtil.unpack(nativeFile, this.getNativesDirectory(), new NameMapper() {
|
||||
public String map(String name) {
|
||||
if (library.extract != null && library.extract.shouldExclude(name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return name;
|
||||
return name;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
hideSubProgressBar();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue