mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
Введение DirBridge
This commit is contained in:
parent
ecb904035a
commit
e4c1a8ce96
8 changed files with 28 additions and 20 deletions
|
@ -17,11 +17,11 @@ var config = {
|
|||
};
|
||||
|
||||
// ====== DON'T TOUCH! ====== //
|
||||
var dir = IOHelper.HOME_DIR.resolve(config.dir);
|
||||
if (!IOHelper.isDir(dir)) {
|
||||
java.nio.file.Files.createDirectory(dir);
|
||||
DirBridge.dir = IOHelper.HOME_DIR.resolve(config.dir);
|
||||
if (!IOHelper.isDir(DirBridge.dir)) {
|
||||
java.nio.file.Files.createDirectory(DirBridge.dir);
|
||||
}
|
||||
var defaultUpdatesDir = dir.resolve("updates");
|
||||
if (!IOHelper.isDir(defaultUpdatesDir)) {
|
||||
java.nio.file.Files.createDirectory(defaultUpdatesDir);
|
||||
DirBridge.defaultUpdatesDir = DirBridge.dir.resolve("updates");
|
||||
if (!IOHelper.isDir(DirBridge.defaultUpdatesDir)) {
|
||||
java.nio.file.Files.createDirectory(DirBridge.defaultUpdatesDir);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ function initDialog() {
|
|||
// Lookup news WebView
|
||||
news = rootPane.lookup("#news");
|
||||
var newsEngine = news.getEngine();
|
||||
newsEngine.setUserDataDirectory(dir.resolve("webview").toFile());
|
||||
newsEngine.setUserDataDirectory(DirBridge.dir.resolve("webview").toFile());
|
||||
newsEngine.load(config.newsURL);
|
||||
|
||||
// Lookup auth pane and dim
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var settings = {
|
||||
file: dir.resolve("settings.bin"), // Settings file
|
||||
file: DirBridge.dir.resolve("settings.bin"), // Settings file
|
||||
login: null, rsaPassword: null, profile: 0, // Auth
|
||||
updatesDir: null, autoEnter: false, fullScreen: false, ram: 0, // Client
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
var Launcher = LauncherClass.static;
|
||||
var LauncherConfig = LauncherConfigClass.static;
|
||||
var HTTPRequest = HTTPRequestClass.static;
|
||||
var DirBridge = DirBridgeClass.static;
|
||||
|
||||
// Hasher class API imports
|
||||
var PlayerProfile = PlayerProfileClass.static;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
var app, stage, scene;
|
||||
|
||||
// internal
|
||||
function getPathDirHelper() {
|
||||
return dir;
|
||||
}
|
||||
|
||||
// Override application class
|
||||
var LauncherApp = Java.extend(JSApplication, {
|
||||
init: function() {
|
||||
|
|
|
@ -16,10 +16,7 @@
|
|||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptException;
|
||||
|
||||
import ru.gravit.launcher.client.ClientLauncher;
|
||||
import ru.gravit.launcher.client.ClientModuleManager;
|
||||
import ru.gravit.launcher.client.JSApplication;
|
||||
import ru.gravit.launcher.client.ServerPinger;
|
||||
import ru.gravit.launcher.client.*;
|
||||
import ru.gravit.launcher.gui.buttons.RingProgressIndicator;
|
||||
import ru.gravit.launcher.gui.buttons.RingProgressIndicatorSkin;
|
||||
import ru.gravit.launcher.hasher.FileNameMatcher;
|
||||
|
@ -135,6 +132,7 @@ public static void addLauncherClassBindings(Map<String, Object> bindings) {
|
|||
bindings.put("SecurityHelperClass", SecurityHelper.class);
|
||||
bindings.put("DigestAlgorithmClass", SecurityHelper.DigestAlgorithm.class);
|
||||
bindings.put("VerifyHelperClass", VerifyHelper.class);
|
||||
bindings.put("DirBridgeClass", DirBridge.class);
|
||||
|
||||
// Load JS API if available
|
||||
bindings.put("RingProgressIndicatorClass", RingProgressIndicator.class);
|
||||
|
@ -206,7 +204,7 @@ public void start(String... args) throws Throwable {
|
|||
LogHelper.info("Invoking start() function");
|
||||
Invocable invoker = (Invocable) engine;
|
||||
if (Launcher.isUsingAvanguard()) {
|
||||
AvanguardStarter.start((Path) invoker.invokeFunction("getPathDirHelper"));
|
||||
AvanguardStarter.start(DirBridge.dir);
|
||||
AvanguardStarter.loadVared();
|
||||
AvanguardStarter.main(false);
|
||||
}
|
||||
|
|
|
@ -346,10 +346,10 @@ else if(isDownloadJava)
|
|||
if(JVMHelper.OS_TYPE == OS.MUSTDIE)
|
||||
javaBin = IOHelper.resolveJavaBin(JavaBinPath);
|
||||
else
|
||||
javaBin = Paths.get(System.getProperty("java.home") + IOHelper.PLATFORM_SEPARATOR + "bin" + IOHelper.PLATFORM_SEPARATOR + "java");
|
||||
javaBin = IOHelper.resolveJavaBin(Paths.get(System.getProperty("java.home")));
|
||||
}
|
||||
else
|
||||
javaBin = Paths.get(System.getProperty("java.home") + IOHelper.PLATFORM_SEPARATOR + "bin" + IOHelper.PLATFORM_SEPARATOR + "java");
|
||||
javaBin = IOHelper.resolveJavaBin(Paths.get(System.getProperty("java.home")));
|
||||
args.add(javaBin.toString());
|
||||
args.add(MAGICAL_INTEL_OPTION);
|
||||
if (params.ram > 0 && params.ram <= JVMHelper.RAM) {
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package ru.gravit.launcher.client;
|
||||
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class DirBridge {
|
||||
@LauncherAPI
|
||||
public static Path dir;
|
||||
@LauncherAPI
|
||||
public static Path dirUpdates;
|
||||
@LauncherAPI
|
||||
public static Path defaultUpdatesDir;
|
||||
}
|
Loading…
Reference in a new issue