mirror of
https://github.com/octopusYan/dayz-mod-translator.git
synced 2025-01-31 11:16:43 +08:00
feat: 打开文件历史
This commit is contained in:
parent
16aa917d09
commit
3ed4979aa9
@ -89,6 +89,9 @@ public class MainController extends BaseController<MainViewModel> {
|
|||||||
fileChooser.getExtensionFilters().add(extFilter);
|
fileChooser.getExtensionFilters().add(extFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private File historySelectFolder;
|
||||||
|
private File historySaveFolder;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pane getRootPanel() {
|
public Pane getRootPanel() {
|
||||||
return root;
|
return root;
|
||||||
@ -150,6 +153,8 @@ public class MainController extends BaseController<MainViewModel> {
|
|||||||
* 打开文件选择器
|
* 打开文件选择器
|
||||||
*/
|
*/
|
||||||
public void selectFile() {
|
public void selectFile() {
|
||||||
|
if (historySelectFolder != null)
|
||||||
|
fileChooser.setInitialDirectory(historySelectFolder);
|
||||||
selectFile(fileChooser.showOpenDialog(getWindow()));
|
selectFile(fileChooser.showOpenDialog(getWindow()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,11 +252,15 @@ public class MainController extends BaseController<MainViewModel> {
|
|||||||
public void onPackOver(File packFile) {
|
public void onPackOver(File packFile) {
|
||||||
// 选择文件保存地址
|
// 选择文件保存地址
|
||||||
fileChooser.setInitialFileName(packFile.getName());
|
fileChooser.setInitialFileName(packFile.getName());
|
||||||
|
if (historySaveFolder != null)
|
||||||
|
fileChooser.setInitialDirectory(historySaveFolder);
|
||||||
File file = fileChooser.showSaveDialog(getWindow());
|
File file = fileChooser.showSaveDialog(getWindow());
|
||||||
|
|
||||||
if (file == null)
|
if (file == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
historySaveFolder = file.getParentFile();
|
||||||
|
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
//文件已存在,则删除覆盖文件
|
//文件已存在,则删除覆盖文件
|
||||||
FileUtils.deleteQuietly(file);
|
FileUtils.deleteQuietly(file);
|
||||||
@ -322,6 +331,10 @@ public class MainController extends BaseController<MainViewModel> {
|
|||||||
* 打开文件
|
* 打开文件
|
||||||
*/
|
*/
|
||||||
private void selectFile(File file) {
|
private void selectFile(File file) {
|
||||||
|
if (file != null) {
|
||||||
|
// 设置选择文件记录
|
||||||
|
historySelectFolder = file.getParentFile();
|
||||||
|
}
|
||||||
viewModel.selectFile(file);
|
viewModel.selectFile(file);
|
||||||
viewModel.unpack();
|
viewModel.unpack();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user