File path in save dialog automatically appended with correct extension if not manually added by the user.

This commit is contained in:
Nathan Warden 2015-01-14 18:02:51 -05:00
parent 04af74596d
commit 7d2f359a0c

View file

@ -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;
}