Open in the same dir last file opened

This commit is contained in:
Crom (Thibaut CHARLES) 2015-03-12 17:22:53 +01:00
parent 883bc3f90d
commit f3f87460d1

View File

@ -2,6 +2,7 @@ import std.stdio;
import std.file; import std.file;
import std.string; import std.string;
import std.conv : to; import std.conv : to;
import std.path;
import gtk.Main; import gtk.Main;
@ -37,7 +38,7 @@ void main(string[] args)
//Window //Window
window = new MainWindow("2DA-Edit"); window = new MainWindow("2DA-Edit");
window.getSettings.setLongProperty("gtk-application-prefer-dark-theme", 1, ""); window.getSettings.setLongProperty("gtk-application-prefer-dark-theme", 0, "");
// //
auto accel = new AccelGroup(); auto accel = new AccelGroup();
@ -126,6 +127,9 @@ void main(string[] args)
import gtk.FileChooserDialog; import gtk.FileChooserDialog;
auto fc = new FileChooserDialog("Save 2DA as", window, FileChooserAction.SAVE); auto fc = new FileChooserDialog("Save 2DA as", window, FileChooserAction.SAVE);
fc.setDoOverwriteConfirmation(true);
fc.setCreateFolders(true);
fc.setCurrentFolder(openedFile!=""? dirName(openedFile) : getcwd());
auto res = fc.run(); auto res = fc.run();
if(res==GtkResponseType.OK){ if(res==GtkResponseType.OK){
string filename = fc.getFilename(); string filename = fc.getFilename();
@ -139,6 +143,8 @@ void main(string[] args)
import gtk.FileChooserDialog; import gtk.FileChooserDialog;
auto fc = new FileChooserDialog("Open 2DA", window, FileChooserAction.OPEN); auto fc = new FileChooserDialog("Open 2DA", window, FileChooserAction.OPEN);
fc.setSelectMultiple(false);
fc.setCurrentFolder(openedFile!=""? dirName(openedFile) : getcwd());
auto res = fc.run(); auto res = fc.run();
if(res==GtkResponseType.OK){ if(res==GtkResponseType.OK){
string filename = fc.getFilename(); string filename = fc.getFilename();