mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-05-11 11:36:35 +03:00
[FIX] Duplicate classpath and modulepath entities
This commit is contained in:
parent
90f74aaf25
commit
911ca1e69f
1 changed files with 17 additions and 12 deletions
|
@ -116,15 +116,6 @@ private static void realMain(String[] args) throws Throwable {
|
||||||
|
|
||||||
// Verify ClientLauncher sign and classpath
|
// Verify ClientLauncher sign and classpath
|
||||||
LogHelper.debug("Verifying ClientLauncher sign and classpath");
|
LogHelper.debug("Verifying ClientLauncher sign and classpath");
|
||||||
Set<Path> ignoredPath = new HashSet<>();
|
|
||||||
List<Path> classpath = resolveClassPath(ignoredPath, clientDir, params.actions, params.profile)
|
|
||||||
.collect(Collectors.toCollection(ArrayList::new));
|
|
||||||
if(LogHelper.isDevEnabled()) {
|
|
||||||
for(var e : classpath) {
|
|
||||||
LogHelper.dev("Classpath entry %s", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List<URL> classpathURLs = classpath.stream().map(IOHelper::toURL).toList();
|
|
||||||
// Start client with WatchService monitoring
|
// Start client with WatchService monitoring
|
||||||
RequestService service;
|
RequestService service;
|
||||||
if (params.offlineMode) {
|
if (params.offlineMode) {
|
||||||
|
@ -158,6 +149,18 @@ private static void realMain(String[] args) throws Throwable {
|
||||||
System.load(Paths.get(params.nativesDir).resolve(ClientService.findLibrary(e)).toAbsolutePath().toString());
|
System.load(Paths.get(params.nativesDir).resolve(ClientService.findLibrary(e)).toAbsolutePath().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Set<Path> ignoredPath = new HashSet<>();
|
||||||
|
if(options.moduleConf != null && options.moduleConf.modulePath != null) {
|
||||||
|
List<Path> resolvedModulePath = resolveClassPath(ignoredPath, clientDir, null, params.profile).toList();
|
||||||
|
}
|
||||||
|
List<Path> classpath = resolveClassPath(ignoredPath, clientDir, params.actions, params.profile)
|
||||||
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
|
if(LogHelper.isDevEnabled()) {
|
||||||
|
for(var e : classpath) {
|
||||||
|
LogHelper.dev("Classpath entry %s", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<URL> classpathURLs = classpath.stream().map(IOHelper::toURL).toList();
|
||||||
if (classLoaderConfig == ClientProfile.ClassLoaderConfig.LAUNCHER || classLoaderConfig == ClientProfile.ClassLoaderConfig.MODULE) {
|
if (classLoaderConfig == ClientProfile.ClassLoaderConfig.LAUNCHER || classLoaderConfig == ClientProfile.ClassLoaderConfig.MODULE) {
|
||||||
if(JVMHelper.JVM_VERSION <= 11) {
|
if(JVMHelper.JVM_VERSION <= 11) {
|
||||||
launch = new LegacyLaunch();
|
launch = new LegacyLaunch();
|
||||||
|
@ -274,9 +277,11 @@ private static Stream<Path> resolveClassPathStream(Set<Path> ignorePaths, Path c
|
||||||
|
|
||||||
public static Stream<Path> resolveClassPath(Set<Path> ignorePaths, Path clientDir, Set<OptionalAction> actions, ClientProfile profile) throws IOException {
|
public static Stream<Path> resolveClassPath(Set<Path> ignorePaths, Path clientDir, Set<OptionalAction> actions, ClientProfile profile) throws IOException {
|
||||||
Stream<Path> result = resolveClassPathStream(ignorePaths, clientDir, profile.getClassPath());
|
Stream<Path> result = resolveClassPathStream(ignorePaths, clientDir, profile.getClassPath());
|
||||||
for (OptionalAction a : actions) {
|
if(actions != null) {
|
||||||
if (a instanceof OptionalActionClassPath)
|
for (OptionalAction a : actions) {
|
||||||
result = Stream.concat(result, resolveClassPathStream(ignorePaths, clientDir, ((OptionalActionClassPath) a).args));
|
if (a instanceof OptionalActionClassPath)
|
||||||
|
result = Stream.concat(result, resolveClassPathStream(ignorePaths, clientDir, ((OptionalActionClassPath) a).args));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue