Перемещение dirUpdates

This commit is contained in:
Gravit 2018-11-26 18:09:22 +07:00
parent 1eb4066250
commit 1e54e661f5
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
3 changed files with 13 additions and 3 deletions

View file

@ -70,8 +70,9 @@ var settingsOverlay = {
// Set new result // Set new result
var newDir = chooser.showDialog(stage); var newDir = chooser.showDialog(stage);
if (newDir !== null) { if (newDir !== null) {
settingsOverlay.transferCatalogDialog(); settingsOverlay.transferCatalogDialog(newDir.toPath());
settings.updatesDir = newDir.toPath(); settings.updatesDir = newDir.toPath();
DirBridge.dirUpdates = settings.updatesDir;
settingsOverlay.updateDirLabel(); settingsOverlay.updateDirLabel();
} }
}); });
@ -137,11 +138,12 @@ var settingsOverlay = {
holder.lookup("#apply").setOnAction(function(event) overlay.hide(0, null)); holder.lookup("#apply").setOnAction(function(event) overlay.hide(0, null));
}, },
transferCatalogDialog: function() { transferCatalogDialog: function(newDir) {
settingsOverlay.transferDialog.setVisible(true); settingsOverlay.transferDialog.setVisible(true);
settingsOverlay.transferDialog.lookup("#cancelTransfer").setOnAction(function(event) settingsOverlay.transferDialog.setVisible(false)); settingsOverlay.transferDialog.lookup("#cancelTransfer").setOnAction(function(event) settingsOverlay.transferDialog.setVisible(false));
settingsOverlay.transferDialog.lookup("#applyTransfer").setOnAction(function(event) { settingsOverlay.transferDialog.lookup("#applyTransfer").setOnAction(function(event) {
//Здесь могла быть ваша реклама, либо DirBridge.move(); //Здесь могла быть ваша реклама, либо DirBridge.move();
DirBridge.move(newDir);
settingsOverlay.transferDialog.setVisible(false); settingsOverlay.transferDialog.setVisible(false);
}); });
}, },

View file

@ -1,7 +1,9 @@
package ru.gravit.launcher.client; package ru.gravit.launcher.client;
import ru.gravit.launcher.LauncherAPI; import ru.gravit.launcher.LauncherAPI;
import ru.gravit.utils.helper.IOHelper;
import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
public class DirBridge { public class DirBridge {
@ -11,5 +13,10 @@ public class DirBridge {
public static Path dirUpdates; public static Path dirUpdates;
@LauncherAPI @LauncherAPI
public static Path defaultUpdatesDir; public static Path defaultUpdatesDir;
@LauncherAPI
public static void move(Path newDir) throws IOException
{
IOHelper.move(dirUpdates,newDir);
dirUpdates = newDir;
}
} }

View file

@ -97,6 +97,7 @@ public void read(HInput input) throws IOException, SignatureException {
// Client settings // Client settings
updatesDir = IOHelper.toPath(input.readString(0)); updatesDir = IOHelper.toPath(input.readString(0));
DirBridge.dirUpdates = updatesDir;
autoEnter = input.readBoolean(); autoEnter = input.readBoolean();
fullScreen = input.readBoolean(); fullScreen = input.readBoolean();
setRAM(input.readLength(JVMHelper.RAM)); setRAM(input.readLength(JVMHelper.RAM));