Merge branch 'master' of https://github.com/Anuken/Mindustry
This commit is contained in:
@@ -17,7 +17,7 @@ import java.util.*;
|
|||||||
|
|
||||||
public class FileChooser extends BaseDialog{
|
public class FileChooser extends BaseDialog{
|
||||||
private static final Fi homeDirectory = Core.files.absolute(Core.files.getExternalStoragePath());
|
private static final Fi homeDirectory = Core.files.absolute(Core.files.getExternalStoragePath());
|
||||||
static Fi lastDirectory = homeDirectory;
|
static Fi lastDirectory = Core.files.absolute(Core.settings.getString("lastDirectory", homeDirectory.absolutePath()));
|
||||||
|
|
||||||
private Table files;
|
private Table files;
|
||||||
Fi directory = lastDirectory;
|
Fi directory = lastDirectory;
|
||||||
@@ -108,7 +108,7 @@ public class FileChooser extends BaseDialog{
|
|||||||
ImageButton home = new ImageButton(Icon.home);
|
ImageButton home = new ImageButton(Icon.home);
|
||||||
home.clicked(() -> {
|
home.clicked(() -> {
|
||||||
directory = homeDirectory;
|
directory = homeDirectory;
|
||||||
lastDirectory = directory;
|
setLastDirectory(directory);
|
||||||
updateFiles(true);
|
updateFiles(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ public class FileChooser extends BaseDialog{
|
|||||||
TextButton upbutton = new TextButton(".." + directory.toString(), Styles.clearTogglet);
|
TextButton upbutton = new TextButton(".." + directory.toString(), Styles.clearTogglet);
|
||||||
upbutton.clicked(() -> {
|
upbutton.clicked(() -> {
|
||||||
directory = directory.parent();
|
directory = directory.parent();
|
||||||
lastDirectory = directory;
|
setLastDirectory(directory);
|
||||||
updateFiles(true);
|
updateFiles(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -217,7 +217,7 @@ public class FileChooser extends BaseDialog{
|
|||||||
updateFileFieldStatus();
|
updateFileFieldStatus();
|
||||||
}else{
|
}else{
|
||||||
directory = directory.child(filename);
|
directory = directory.child(filename);
|
||||||
lastDirectory = directory;
|
setLastDirectory(directory);
|
||||||
updateFiles(true);
|
updateFiles(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -242,6 +242,11 @@ public class FileChooser extends BaseDialog{
|
|||||||
if(open) filefield.clearText();
|
if(open) filefield.clearText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setLastDirectory(Fi directory){
|
||||||
|
lastDirectory = directory;
|
||||||
|
Core.settings.put("lastDirectory", directory.absolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
private String shorten(String string){
|
private String shorten(String string){
|
||||||
int max = 30;
|
int max = 30;
|
||||||
if(string.length() <= max){
|
if(string.length() <= max){
|
||||||
@@ -269,14 +274,14 @@ public class FileChooser extends BaseDialog{
|
|||||||
if(!canBack()) return;
|
if(!canBack()) return;
|
||||||
index--;
|
index--;
|
||||||
directory = history.get(index - 1);
|
directory = history.get(index - 1);
|
||||||
lastDirectory = directory;
|
setLastDirectory(directory);
|
||||||
updateFiles(false);
|
updateFiles(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forward(){
|
public void forward(){
|
||||||
if(!canForward()) return;
|
if(!canForward()) return;
|
||||||
directory = history.get(index);
|
directory = history.get(index);
|
||||||
lastDirectory = directory;
|
setLastDirectory(directory);
|
||||||
index++;
|
index++;
|
||||||
updateFiles(false);
|
updateFiles(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user