Skip to content

Commit

Permalink
Warning message on backup fail.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fexcraft committed Sep 18, 2020
1 parent 8076644 commit ad014ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions resources/lang/default.lang
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ saveload.open.errors=Errors occured while parsing save file.
saveload.save.nofile=Model save file is 'null'! Model will not be saved.
saveload.save.success=Model Saved!
saveload.should_save=Do you want to save the current model first?
saveload.backup.error0=Errors during creating a backup, please check the log.
saveload.backup.error1=WARNING: Any progress may not be able to save!

# Helper/Preview Collector
helper_collector.title=Helper/Preview Collector
Expand Down
19 changes: 14 additions & 5 deletions src/net/fexcraft/app/fmt/utils/Backups.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.TimerTask;

import net.fexcraft.app.fmt.FMTB;
import net.fexcraft.app.fmt.ui.DialogBox;
import net.fexcraft.lib.common.math.Time;

/**
Expand All @@ -21,11 +22,19 @@ public class Backups extends TimerTask {
@Override
public void run(){
if(FMTB.MODEL.countTotalMRTs() <= 0) return;
String str = sdf.format(Time.getDate());
log("Saving backup... [" + str + "];");
File file = new File("./backups/(" + str + ") " + FMTB.MODEL.name + ".fmtb");
if(!file.getParentFile().exists()) file.getParentFile().mkdirs();
SaveLoad.toFile(FMTB.MODEL, file, false);
try{
String nani = null;
nani.split("");
String str = sdf.format(Time.getDate());
log("Saving backup... [" + str + "];");
File file = new File("./backups/(" + str + ") " + FMTB.MODEL.name + ".fmtb");
if(!file.getParentFile().exists()) file.getParentFile().mkdirs();
SaveLoad.toFile(FMTB.MODEL, file, false);
}
catch(Exception e){
DialogBox.showOK("saveload.title", null, null, "saveload.backup.error0", "saveload.backup.error1");
e.printStackTrace();
}
}

private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH.mm.ss");
Expand Down

0 comments on commit ad014ab

Please sign in to comment.