New Android file chooser implementation
This commit is contained in:
@@ -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(){
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user