mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
Merge branch 'experimental/5.3.0' into experimental/profiles-rework
This commit is contained in:
commit
bd4e454be9
2 changed files with 10 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
|||
import java.net.URLClassLoader;
|
||||
|
||||
public class ClientClassLoader extends URLClassLoader {
|
||||
private static final ClassLoader SYSTEM_CLASS_LOADER = ClassLoader.getSystemClassLoader();
|
||||
public String nativePath;
|
||||
|
||||
/**
|
||||
|
@ -58,6 +59,14 @@ public ClientClassLoader(URL[] urls, ClassLoader parent) {
|
|||
super(urls, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
|
||||
if(name != null && (name.startsWith("pro.gravit.launcher.") || name.startsWith("pro.gravit.utils."))) {
|
||||
return SYSTEM_CLASS_LOADER.loadClass(name);
|
||||
}
|
||||
return super.loadClass(name, resolve);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findLibrary(String name) {
|
||||
return nativePath.concat(IOHelper.PLATFORM_SEPARATOR).concat(getNativePrefix()).concat(name).concat(getNativeEx());
|
||||
|
|
|
@ -143,7 +143,7 @@ public static void main(String[] args) throws Throwable {
|
|||
LogHelper.debug("Natives dir %s", params.nativesDir);
|
||||
ClientProfile.ClassLoaderConfig classLoaderConfig = profile.getClassLoaderConfig();
|
||||
if (classLoaderConfig == ClientProfile.ClassLoaderConfig.LAUNCHER) {
|
||||
ClientClassLoader classLoader = new ClientClassLoader(classpathURLs.toArray(new URL[0]), ClassLoader.getSystemClassLoader());
|
||||
ClientClassLoader classLoader = new ClientClassLoader(classpathURLs.toArray(new URL[0]), ClientLauncherEntryPoint.class.getClassLoader());
|
||||
System.setProperty("java.class.path", classpath.stream().map(Path::toString).collect(Collectors.joining(File.pathSeparator)));
|
||||
ClientLauncherEntryPoint.classLoader = classLoader;
|
||||
Thread.currentThread().setContextClassLoader(classLoader);
|
||||
|
|
Loading…
Reference in a new issue