mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-26 15:27:19 +07:00
Implemented basic save backups
This commit is contained in:
parent
3a46146055
commit
d12f78f6ce
@ -25,7 +25,14 @@ public class SaveIO{
|
||||
Settings.putString("save-"+slot+"-data", new String(Base64Coder.encode(stream.toByteArray())));
|
||||
Settings.save();
|
||||
}else{
|
||||
write(fileFor(slot));
|
||||
FileHandle file = fileFor(slot);
|
||||
file.moveTo(file.sibling(file.name() + "-backup." + file.extension()));
|
||||
try {
|
||||
write(fileFor(slot));
|
||||
}catch (Exception e){
|
||||
file.sibling(file.name() + "-backup." + file.extension()).moveTo(file);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user