New Android file chooser implementation

This commit is contained in:
Anuken
2019-09-06 21:21:30 -04:00
parent b492c7ae27
commit b5f1e566b2
13 changed files with 87 additions and 142 deletions

View File

@@ -52,10 +52,12 @@ public class GlobalData{
}
public void importData(FileHandle file){
FileHandle zipped = new ZipFileHandle(file);
FileHandle dest = Core.files.local("zipdata.zip");
file.copyTo(dest);
FileHandle zipped = new ZipFileHandle(dest);
FileHandle base = Core.settings.getDataDirectory();
if(!base.child("settings.bin").exists()){
if(!zipped.child("settings.bin").exists()){
throw new IllegalArgumentException("Not valid save data.");
}
@@ -63,12 +65,13 @@ public class GlobalData{
for(FileHandle f : base.list()){
if(f.isDirectory()){
f.deleteDirectory();
}else{
}else if(!f.name().equals("zipdata.zip")){
f.delete();
}
}
zipped.walk(f -> f.copyTo(base.child(f.path())));
dest.delete();
}
public void modified(){

View File

@@ -297,9 +297,6 @@ public class Saves{
public void exportFile(FileHandle file) throws IOException{
try{
if(!file.extension().equals(saveExtension)){
file = file.parent().child(file.nameWithoutExtension() + "." + saveExtension);
}
SaveIO.fileFor(index).copyTo(file);
}catch(Exception e){
throw new IOException(e);