This commit is contained in:
Anuken 2019-11-09 17:19:29 -05:00
parent 2af13a31dc
commit 4c0607aba8
3 changed files with 17 additions and 24 deletions

View File

@ -18,7 +18,7 @@ import java.util.*;
import static io.anuke.mindustry.Vars.platform;
public class FileChooser extends FloatingDialog{
private static final FileHandle homeDirectory = Core.files.absolute(OS.isMac ? OS.getProperty("user.home") + "/Downloads/" : Core.files.getExternalStoragePath());
private static final FileHandle homeDirectory = Core.files.absolute(Core.files.getExternalStoragePath());
private static FileHandle lastDirectory = homeDirectory;
private Table files;
@ -98,10 +98,6 @@ public class FileChooser extends FloatingDialog{
updateFiles(true);
});
//Macs are confined to the Downloads/ directory
if(OS.isMac){
up.setDisabled(true);
}
ImageButton back = new ImageButton(Icon.arrowLeft);
ImageButton forward = new ImageButton(Icon.arrowRight);
@ -171,8 +167,7 @@ public class FileChooser extends FloatingDialog{
private void updateFiles(boolean push){
if(push) stack.push(directory);
//if is mac, don't display extra info since you can only ever go to downloads
navigation.setText(OS.isMac ? directory.name() : directory.toString());
navigation.setText(directory.toString());
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
@ -190,23 +185,21 @@ public class FileChooser extends FloatingDialog{
files.top().left();
FileHandle[] names = getFileNames();
//macs are confined to the Downloads/ directory
if(!OS.isMac){
Image upimage = new Image(Icon.folderParentSmall);
TextButton upbutton = new TextButton(".." + directory.toString(), Styles.clearTogglet);
upbutton.clicked(() -> {
directory = directory.parent();
lastDirectory = directory;
updateFiles(true);
});
Image upimage = new Image(Icon.folderParentSmall);
TextButton upbutton = new TextButton(".." + directory.toString(), Styles.clearTogglet);
upbutton.clicked(() -> {
directory = directory.parent();
lastDirectory = directory;
updateFiles(true);
});
upbutton.left().add(upimage).padRight(4f).padLeft(4);
upbutton.getLabel().setAlignment(Align.left);
upbutton.getCells().reverse();
upbutton.left().add(upimage).padRight(4f).padLeft(4);
upbutton.getLabel().setAlignment(Align.left);
upbutton.getCells().reverse();
files.add(upbutton).align(Align.topLeft).fillX().expandX().height(50).pad(2).colspan(2);
files.row();
files.add(upbutton).align(Align.topLeft).fillX().expandX().height(50).pad(2).colspan(2);
files.row();
}
ButtonGroup<TextButton> group = new ButtonGroup<>();
group.setMinCheckCount(0);

View File

@ -95,7 +95,7 @@ public class ModsDialog extends FloatingDialog{
void modError(Throwable error){
ui.loadfrag.hide();
if(Strings.getCauses(error).contains(t -> t.getMessage() != null && t.getMessage().contains("SSL"))){
if(Strings.getCauses(error).contains(t -> t.getMessage() != null && (t.getMessage().contains("SSL") || t.getMessage().contains("protocol")))){
ui.showErrorMessage("$feature.unsupported");
}else{
ui.showException(error);

View File

@ -242,7 +242,7 @@ public class DesktopLauncher extends ClientLauncher{
Cons<Runnable> dialog = Runnable::run;
boolean badGPU = false;
if(e.getMessage() != null && (e.getMessage().contains("Couldn't create window") || e.getMessage().contains("OpenGL 2.0 or higher"))){
if(e.getMessage() != null && (e.getMessage().contains("Couldn't create window") || e.getMessage().contains("OpenGL 2.0 or higher") || e.getMessage().toLowerCase().contains("pixel format"))){
dialog.get(() -> message(
e.getMessage().contains("Couldn't create window") ? "A graphics initialization error has occured! Try to update your graphics drivers:\n" + e.getMessage() :