Made saves load backup files if original save gets corrupted

This commit is contained in:
Anuken
2018-04-16 21:11:49 -04:00
parent d396149521
commit ee24eb8d1b
2 changed files with 11 additions and 3 deletions

View File

@ -1,7 +1,7 @@
#Autogenerated file. Do not modify. #Autogenerated file. Do not modify.
#Sun Apr 15 23:12:17 EDT 2018 #Mon Apr 16 21:11:17 EDT 2018
version=release version=release
androidBuildCode=517 androidBuildCode=519
name=Mindustry name=Mindustry
code=3.5 code=3.5
build=custom build build=custom build

View File

@ -130,7 +130,15 @@ public class SaveIO{
} }
public static void load(FileHandle file){ public static void load(FileHandle file){
load(file.read()); try {
load(file.read());
}catch (RuntimeException e){
e.printStackTrace();
FileHandle backup = file.sibling(file.name() + "-backup." + file.extension());
if(backup.exists()){
load(backup.read());
}
}
} }
public static void load(InputStream is){ public static void load(InputStream is){