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 {
|
||||
File source = new FileHandle(ForgeProfileProperties.getUserDir() + "/adventure/Shandalar").file();
|
||||
File target = new FileHandle(Forge.getDeviceAdapter().getDownloadsDir()).file();
|
||||
ZipUtil.zip(source, target);
|
||||
ZipUtil.zip(source, target, ZipUtil.backupAdvFile);
|
||||
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);
|
||||
} catch (IOException e) {
|
||||
zipDialog = createGenericDialog("",
|
||||
@@ -170,7 +170,7 @@ public class StartScene extends UIScene {
|
||||
return true;
|
||||
}
|
||||
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();
|
||||
if (unzipDialog == null) {
|
||||
unzipDialog = createGenericDialog("",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package forge.util;
|
||||
|
||||
import java.io.*;
|
||||
//import java.time.Instant;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
@@ -10,13 +9,10 @@ import java.util.zip.ZipOutputStream;
|
||||
* https://www.baeldung.com/java-compress-and-uncompress
|
||||
*/
|
||||
public class ZipUtil {
|
||||
public static String backupFile = "forge.adv";
|
||||
public static void zip(File source, File dest) throws IOException {
|
||||
//String now = Instant.now().toString() + "-";
|
||||
FileOutputStream fos = new FileOutputStream(dest.getAbsolutePath() + File.separator /*+ now*/ + backupFile);
|
||||
public static String backupAdvFile = "forge.adv";
|
||||
public static void zip(File source, File dest, String name) throws IOException {
|
||||
FileOutputStream fos = new FileOutputStream(dest.getAbsolutePath() + File.separator + name);
|
||||
ZipOutputStream zipOut = new ZipOutputStream(fos);
|
||||
|
||||
//File fileToZip = new File(sourceFile);
|
||||
zipFile(source, source.getName(), zipOut);
|
||||
zipOut.close();
|
||||
fos.close();
|
||||
|
||||
Reference in New Issue
Block a user