make the injector more reliable
This commit is contained in:
@@ -72,6 +72,7 @@ import org.apache.commons.io.FileUtils;
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ClientLoader implements Supplier<Applet>
|
||||
{
|
||||
private static final String INJECTED_CLIENT_NAME = "/injected-client.oprs";
|
||||
private static final int NUM_ATTEMPTS = 6;
|
||||
private static File LOCK_FILE = new File(RuneLite.CACHE_DIR, "cache.lock");
|
||||
private static File VANILLA_CACHE = new File(RuneLite.CACHE_DIR, "vanilla.cache");
|
||||
@@ -132,9 +133,11 @@ public class ClientLoader implements Supplier<Applet>
|
||||
// create the classloader for the jar while we hold the lock, and eagerly load and link all classes
|
||||
// in the jar. Otherwise the jar can change on disk and can break future classloads.
|
||||
File oprsInjected = new File(System.getProperty("user.home") + "/.openosrs/cache/injected-client.jar");
|
||||
InputStream initialStream = RuneLite.class.getResourceAsStream("injected-client.oprs");
|
||||
if (!oprsInjected.exists() || oprsInjected.length() != RuneLite.class.getResource("injected-client.oprs").getFile().length())
|
||||
InputStream initialStream = RuneLite.class.getResourceAsStream(INJECTED_CLIENT_NAME);
|
||||
if (!oprsInjected.exists() || oprsInjected.length() != RuneLite.class.getResource(INJECTED_CLIENT_NAME).getFile().length())
|
||||
{
|
||||
FileUtils.copyInputStreamToFile(initialStream, oprsInjected);
|
||||
}
|
||||
|
||||
classLoader = createJarClassLoader(oprsInjected);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user