mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-28 07:22:21 -08:00
Fixed iOS sharing
This commit is contained in:
parent
c51fcd3839
commit
78af4e2120
1 changed files with 26 additions and 16 deletions
|
|
@ -199,24 +199,19 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||
t.row();
|
||||
|
||||
t.button("@crash.export", Icon.upload, style, () -> {
|
||||
if(settings.getDataDirectory().child("crashes").list().length == 0){
|
||||
if(settings.getDataDirectory().child("crashes").list().length == 0 && !settings.getDataDirectory().child("last_log.txt").exists()){
|
||||
ui.showInfo("@crash.none");
|
||||
}else{
|
||||
platform.showFileChooser(false, "txt", file -> {
|
||||
Fi log = settings.getDataDirectory().child("last_log.txt");
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
for(Fi fi : settings.getDataDirectory().child("crashes").list()){
|
||||
out.append(fi.name()).append("\n\n").append(fi.readString()).append("\n");
|
||||
}
|
||||
|
||||
if(log.exists()){
|
||||
out.append("\nlast log:\n").append(log.readString());
|
||||
}
|
||||
|
||||
file.writeString(out.toString());
|
||||
app.post(() -> ui.showInfo("@crash.exported"));
|
||||
});
|
||||
if(ios){
|
||||
Fi logs = tmpDirectory.child("logs.txt");
|
||||
logs.writeString(getLogs());
|
||||
platform.shareFile(logs);
|
||||
}else{
|
||||
platform.showFileChooser(false, "txt", file -> {
|
||||
file.writeString(getLogs());
|
||||
app.post(() -> ui.showInfo("@crash.exported"));
|
||||
});
|
||||
}
|
||||
}
|
||||
}).marginLeft(4);
|
||||
});
|
||||
|
|
@ -250,6 +245,21 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||
addSettings();
|
||||
}
|
||||
|
||||
String getLogs(){
|
||||
Fi log = settings.getDataDirectory().child("last_log.txt");
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
for(Fi fi : settings.getDataDirectory().child("crashes").list()){
|
||||
out.append(fi.name()).append("\n\n").append(fi.readString()).append("\n");
|
||||
}
|
||||
|
||||
if(log.exists()){
|
||||
out.append("\nlast log:\n").append(log.readString());
|
||||
}
|
||||
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
void rebuildMenu(){
|
||||
menu.clearChildren();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue