mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-22 04:28:27 +07:00
More file chooser fixes
This commit is contained in:
parent
b5f1e566b2
commit
168011586b
@ -32,32 +32,9 @@
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<data android:mimeType="application/octet-stream"/>
|
||||
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.mmap"/>
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<data android:mimeType="application/octet-stream"/>
|
||||
<data android:mimeType="application/octet-stream" />
|
||||
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.msav"/>
|
||||
</intent-filter>
|
||||
|
||||
|
||||
<intent-filter android:icon="@mipmap/ic_launcher"
|
||||
android:label="Mindustry Map"
|
||||
android:priority="1">
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.mmap" android:mimeType="*/*"/>
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.msav" android:mimeType="*/*"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
|
@ -233,7 +233,7 @@ editor.removeunit = Remove Unit
|
||||
editor.teams = Teams
|
||||
editor.errorload = Error loading file:\n[accent]{0}
|
||||
editor.errorsave = Error saving file:\n[accent]{0}
|
||||
editor.errorimage = That's an image, not a map. Don't go around changing extensions expecting it to work.\n\nIf you want to import a legacy map, use the 'import legacy map' button in the editor.
|
||||
editor.errorimage = That's an image, not a map.\n\nIf you want to import a 3.5/build 40 map, use the 'Import Legacy Map' button in the editor.
|
||||
editor.errorlegacy = This map is too old, and uses a legacy map format that is no longer supported.
|
||||
editor.errornot = This is not a map file.
|
||||
editor.errorheader = This map file is either not valid or corrupt.
|
||||
@ -254,7 +254,7 @@ editor.importmap = Import Map
|
||||
editor.importmap.description = Import an already existing map
|
||||
editor.importfile = Import File
|
||||
editor.importfile.description = Import an external map file
|
||||
editor.importimage = Import Legacy Image
|
||||
editor.importimage = Import Legacy Map
|
||||
editor.importimage.description = Import an external map image file
|
||||
editor.export = Export...
|
||||
editor.exportfile = Export File
|
||||
|
@ -184,7 +184,18 @@ public class Maps{
|
||||
FileHandle dest = findFile();
|
||||
file.copyTo(dest);
|
||||
|
||||
createNewPreview(loadMap(dest, true));
|
||||
Map map = loadMap(dest, true);
|
||||
Exception[] error = {null};
|
||||
|
||||
createNewPreview(map, e -> {
|
||||
maps.remove(map);
|
||||
error[0] = e;
|
||||
});
|
||||
|
||||
if(error[0] != null){
|
||||
throw new IOException(error[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Attempts to run the following code;
|
||||
@ -313,7 +324,7 @@ public class Maps{
|
||||
private void createAllPreviews(){
|
||||
Core.app.post(() -> {
|
||||
for(Map map : previewList){
|
||||
createNewPreview(map);
|
||||
createNewPreview(map, e -> Core.app.post(() -> map.texture = new Texture("sprites/error.png")));
|
||||
}
|
||||
previewList.clear();
|
||||
});
|
||||
@ -323,7 +334,7 @@ public class Maps{
|
||||
Core.app.post(() -> previewList.add(map));
|
||||
}
|
||||
|
||||
private void createNewPreview(Map map){
|
||||
private void createNewPreview(Map map, Consumer<Exception> failed){
|
||||
try{
|
||||
//if it's here, then the preview failed to load or doesn't exist, make it
|
||||
//this has to be done synchronously!
|
||||
@ -337,9 +348,9 @@ public class Maps{
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}catch(IOException e){
|
||||
}catch(Exception e){
|
||||
failed.accept(e);
|
||||
Log.err("Failed to generate preview!", e);
|
||||
Core.app.post(() -> map.texture = new Texture("sprites/error.png"));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user