[FIX] Исправление optional classpath

This commit is contained in:
Gravit 2019-12-11 07:59:04 +07:00
parent 4779d6e08b
commit 117b95d3fc
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -465,18 +465,14 @@ public static void main(String... args) throws Throwable {
LauncherEngine.modulesManager.invokeEvent(new ClientLauncherInitPhase(context)); LauncherEngine.modulesManager.invokeEvent(new ClientLauncherInitPhase(context));
// Verify ClientLauncher sign and classpath // Verify ClientLauncher sign and classpath
LogHelper.debug("Verifying ClientLauncher sign and classpath"); LogHelper.debug("Verifying ClientLauncher sign and classpath");
LinkedList<Path> classPath = resolveClassPathList(params.clientDir, profile.getClassPath()); URL[] classpath = resolveClassPath(params.clientDir, profile.getClassPath());
for (Path classpathURL : classPath) { classLoader = new ClientClassLoader(classpath, ClassLoader.getSystemClassLoader());
//LauncherAgent.addJVMClassPath(classpathURL.normalize().toAbsolutePath());
}
profile.pushOptionalClassPath(cp -> { profile.pushOptionalClassPath(cp -> {
LinkedList<Path> optionalClassPath = resolveClassPathList(params.clientDir, cp); LinkedList<Path> optionalClassPath = resolveClassPathList(params.clientDir, cp);
for (Path classpathURL : optionalClassPath) { for (Path classpathURL : optionalClassPath) {
//LauncherAgent.addJVMClassPath(classpathURL.normalize().toAbsolutePath()); classLoader.addURL(classpathURL.normalize().toAbsolutePath().toUri().toURL());
} }
}); });
URL[] classpathurls = resolveClassPath(params.clientDir, profile.getClassPath());
classLoader = new ClientClassLoader(classpathurls, ClassLoader.getSystemClassLoader());
Thread.currentThread().setContextClassLoader(classLoader); Thread.currentThread().setContextClassLoader(classLoader);
classLoader.nativePath = params.clientDir.resolve(NATIVES_DIR).toString(); classLoader.nativePath = params.clientDir.resolve(NATIVES_DIR).toString();
// Start client with WatchService monitoring // Start client with WatchService monitoring
@ -506,7 +502,7 @@ public static void main(String... args) throws Throwable {
ClientService.classLoader = classLoader; ClientService.classLoader = classLoader;
classLoader.addURL(IOHelper.getCodeSource(ClientLauncher.class).toUri().toURL()); classLoader.addURL(IOHelper.getCodeSource(ClientLauncher.class).toUri().toURL());
//classForName(classLoader, "com.google.common.collect.ForwardingMultimap"); //classForName(classLoader, "com.google.common.collect.ForwardingMultimap");
ClientService.baseURLs = classpathurls; ClientService.baseURLs = classpath;
LogHelper.debug("Starting JVM and client WatchService"); LogHelper.debug("Starting JVM and client WatchService");
FileNameMatcher assetMatcher = profile.getAssetUpdateMatcher(); FileNameMatcher assetMatcher = profile.getAssetUpdateMatcher();
FileNameMatcher clientMatcher = profile.getClientUpdateMatcher(); FileNameMatcher clientMatcher = profile.getClientUpdateMatcher();