13
0

Lua-dialog: allow to set folder for file to load/save.

When a non-existent file-path is given, GTK falls back to show the
containing folder and automatically goes up to parent folders until
the root.

This removes the explicit file/folder check and delegates the
behavior to GTK, allowing to set a folder for a non-existent file.
This commit is contained in:
Robin Gareus 2018-08-02 00:53:18 +02:00
parent b45c7089c6
commit 5006c731c7

View File

@ -524,14 +524,8 @@ public:
switch (a) {
case Gtk::FILE_CHOOSER_ACTION_OPEN:
case Gtk::FILE_CHOOSER_ACTION_SAVE:
if (Glib::file_test (path, Glib::FILE_TEST_IS_REGULAR|Glib::FILE_TEST_EXISTS)) {
_fc.set_filename (path);
}
break;
case Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER:
if (Glib::file_test (path, Glib::FILE_TEST_IS_DIR|Glib::FILE_TEST_EXISTS)) {
_fc.set_filename (path);
}
_fc.set_filename (path);
break;
case Gtk::FILE_CHOOSER_ACTION_CREATE_FOLDER:
break;