mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
update
This commit is contained in:
@@ -156,9 +156,9 @@ public class StartScene extends UIScene {
|
|||||||
try {
|
try {
|
||||||
File source = new FileHandle(ForgeProfileProperties.getUserDir() + "/adventure/Shandalar").file();
|
File source = new FileHandle(ForgeProfileProperties.getUserDir() + "/adventure/Shandalar").file();
|
||||||
File target = new FileHandle(Forge.getDeviceAdapter().getDownloadsDir()).file();
|
File target = new FileHandle(Forge.getDeviceAdapter().getDownloadsDir()).file();
|
||||||
ZipUtil.zip(source, target);
|
ZipUtil.zip(source, target, ZipUtil.backupAdvFile);
|
||||||
zipDialog = createGenericDialog("",
|
zipDialog = createGenericDialog("",
|
||||||
Forge.getLocalizer().getMessage("lblSaveLocation") + "\n" + target.getAbsolutePath() + File.separator + ZipUtil.backupFile,
|
Forge.getLocalizer().getMessage("lblSaveLocation") + "\n" + target.getAbsolutePath() + File.separator + ZipUtil.backupAdvFile,
|
||||||
Forge.getLocalizer().getMessage("lblOK"), null, this::removeDialog, null);
|
Forge.getLocalizer().getMessage("lblOK"), null, this::removeDialog, null);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
zipDialog = createGenericDialog("",
|
zipDialog = createGenericDialog("",
|
||||||
@@ -170,7 +170,7 @@ public class StartScene extends UIScene {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public boolean restoreBackup() {
|
public boolean restoreBackup() {
|
||||||
File source = new FileHandle(Forge.getDeviceAdapter().getDownloadsDir() + ZipUtil.backupFile).file();
|
File source = new FileHandle(Forge.getDeviceAdapter().getDownloadsDir() + ZipUtil.backupAdvFile).file();
|
||||||
File target = new FileHandle(ForgeProfileProperties.getUserDir() + "/adventure/Shandalar").file().getParentFile();
|
File target = new FileHandle(ForgeProfileProperties.getUserDir() + "/adventure/Shandalar").file().getParentFile();
|
||||||
if (unzipDialog == null) {
|
if (unzipDialog == null) {
|
||||||
unzipDialog = createGenericDialog("",
|
unzipDialog = createGenericDialog("",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package forge.util;
|
package forge.util;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
//import java.time.Instant;
|
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
@@ -10,13 +9,10 @@ import java.util.zip.ZipOutputStream;
|
|||||||
* https://www.baeldung.com/java-compress-and-uncompress
|
* https://www.baeldung.com/java-compress-and-uncompress
|
||||||
*/
|
*/
|
||||||
public class ZipUtil {
|
public class ZipUtil {
|
||||||
public static String backupFile = "forge.adv";
|
public static String backupAdvFile = "forge.adv";
|
||||||
public static void zip(File source, File dest) throws IOException {
|
public static void zip(File source, File dest, String name) throws IOException {
|
||||||
//String now = Instant.now().toString() + "-";
|
FileOutputStream fos = new FileOutputStream(dest.getAbsolutePath() + File.separator + name);
|
||||||
FileOutputStream fos = new FileOutputStream(dest.getAbsolutePath() + File.separator /*+ now*/ + backupFile);
|
|
||||||
ZipOutputStream zipOut = new ZipOutputStream(fos);
|
ZipOutputStream zipOut = new ZipOutputStream(fos);
|
||||||
|
|
||||||
//File fileToZip = new File(sourceFile);
|
|
||||||
zipFile(source, source.getName(), zipOut);
|
zipFile(source, source.getName(), zipOut);
|
||||||
zipOut.close();
|
zipOut.close();
|
||||||
fos.close();
|
fos.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user