summaryrefslogtreecommitdiffstats
path: root/scene/gui/file_dialog.cpp
diff options
context:
space:
mode:
authorNathan Warden <nathanwardenlee@icloud.com>2015-01-14 18:02:51 -0500
committerNathan Warden <nathanwardenlee@icloud.com>2015-01-14 18:05:57 -0500
commit7d2f359a0c5ec72d07f95491baa698b800b04069 (patch)
treefd3e56cd467e009e3839893c51720d46b5d03c8f /scene/gui/file_dialog.cpp
parent04af74596d070f062bd917b0364d87c57544f8d5 (diff)
downloadredot-engine-7d2f359a0c5ec72d07f95491baa698b800b04069.tar.gz
File path in save dialog automatically appended with correct extension if not manually added by the user.
Diffstat (limited to 'scene/gui/file_dialog.cpp')
-rw-r--r--scene/gui/file_dialog.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index a7ff1431bd..a98cb841dc 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -184,7 +184,8 @@ void FileDialog::_action_pressed() {
if (idx>=0 && idx<filters.size()) {
String flt=filters[idx].get_slice(";",0);
- for (int j=0;j<flt.get_slice_count(",");j++) {
+ int filterSliceCount=flt.get_slice_count(",");
+ for (int j=0;j<filterSliceCount;j++) {
String str = (flt.get_slice(",",j).strip_edges());
if (f.match(str)) {
@@ -192,6 +193,12 @@ void FileDialog::_action_pressed() {
break;
}
}
+
+ if (!valid && filterSliceCount>0) {
+ String str = (flt.get_slice(",",0).strip_edges());
+ f+=str.substr(1, str.length()-1);
+ valid=true;
+ }
} else {
valid=true;
}