[FIX] ProGuard and launchserver.dir.libraries

This commit is contained in:
Gravita 2024-07-17 01:32:51 +07:00
parent 992d31c883
commit 1bd5d8854c
No known key found for this signature in database
GPG key ID: 543A8F335C9CD633
2 changed files with 7 additions and 3 deletions

View file

@ -84,6 +84,7 @@ public final class LaunchServer implements Runnable, AutoCloseable, Reconfigurab
public final Path tmpDir;
public final Path modulesDir;
public final Path launcherModulesDir;
public final Path librariesDir;
/**
* This object contains runtime configuration
*/
@ -140,6 +141,7 @@ public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, La
launcherPack = directories.launcherPackDir;
modulesDir = directories.modules;
launcherModulesDir = directories.launcherModules;
librariesDir = directories.launcherLibrariesDir;
this.shardId = shardId;
if(!Files.isDirectory(launcherPack)) {
Files.createDirectories(launcherPack);
@ -495,9 +497,10 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
public static class LaunchServerDirectories {
public static final String UPDATES_NAME = "updates", PROFILES_NAME = "profiles",
TRUSTSTORE_NAME = "truststore", LAUNCHERLIBRARIES_NAME = "launcher-libraries",
LAUNCHERLIBRARIESCOMPILE_NAME = "launcher-libraries-compile", LAUNCHERPACK_NAME = "launcher-pack", KEY_NAME = ".keys", MODULES = "modules", LAUNCHER_MODULES = "launcher-modules";
LAUNCHERLIBRARIESCOMPILE_NAME = "launcher-libraries-compile", LAUNCHERPACK_NAME = "launcher-pack", KEY_NAME = ".keys", MODULES = "modules", LAUNCHER_MODULES = "launcher-modules", LIBRARIES = "libraries";
public Path updatesDir;
public Path profilesDir;
public Path librariesDir;
public Path launcherLibrariesDir;
public Path launcherLibrariesCompileDir;
public Path launcherPackDir;
@ -520,6 +523,7 @@ public void collect() {
if (keyDirectory == null) keyDirectory = getPath(KEY_NAME);
if (modules == null) modules = getPath(MODULES);
if (launcherModules == null) launcherModules = getPath(LAUNCHER_MODULES);
if (librariesDir == null) librariesDir = getPath(LIBRARIES);
if (tmpDir == null)
tmpDir = Paths.get(System.getProperty("java.io.tmpdir")).resolve("launchserver-%s".formatted(SecurityHelper.randomStringToken()));
}

View file

@ -213,7 +213,7 @@ public Path process(Path inputFile) throws IOException {
args.add(IOHelper.resolveJavaBin(IOHelper.JVM_DIR).toAbsolutePath().toString());
args.addAll(component.jvmArgs);
args.add("-cp");
try(Stream<Path> files = Files.walk(Path.of("libraries"), FileVisitOption.FOLLOW_LINKS)) {
try(Stream<Path> files = Files.walk(server.librariesDir, FileVisitOption.FOLLOW_LINKS)) {
args.add(files
.filter(e -> e.getFileName().toString().endsWith(".jar"))
.map(path -> path.toAbsolutePath().toString())