fix #2267: filter duplicate jars in the class path (#2280)

This commit is contained in:
Glavo 2023-06-11 15:47:43 +08:00 committed by GitHub
parent 811707b611
commit 0280a34d00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -23,10 +23,10 @@ import org.jackhuang.hmcl.util.platform.Platform;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.LinkedHashSet;
import java.util.Optional;
import java.util.Set;
/**
* Supports operations on versioning.
@ -250,8 +250,8 @@ public interface GameRepository extends VersionProvider {
*/
Path getLoggingObject(String version, String assetId, LoggingInfo loggingInfo);
default List<String> getClasspath(Version version) {
List<String> classpath = new ArrayList<>();
default Set<String> getClasspath(Version version) {
Set<String> classpath = new LinkedHashSet<>();
for (Library library : version.getLibraries())
if (library.appliesToCurrentEnvironment() && !library.isNative()) {
File f = getLibraryFile(version, library);

View File

@ -207,7 +207,7 @@ public class DefaultLauncher extends Launcher {
res.addDefault("-Dfml.ignorePatchDiscrepancies=", "true");
}
List<String> classpath = repository.getClasspath(version);
Set<String> classpath = repository.getClasspath(version);
File jar = repository.getVersionJar(version);
if (!jar.exists() || !jar.isFile())