diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-01-17 09:43:00 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-01-17 09:43:00 -0300 |
commit | 07e63c3dc11c9f8203e1e357966a490f88ee4578 (patch) | |
tree | d3c85b88693195a02957d097b15a229c3178e90c /scene/gui/file_dialog.cpp | |
parent | be7d8a182c066bf61a01635c83a80288c537325f (diff) | |
parent | cac555dc78047b96486d5c52e990c7dde62f0a6b (diff) |
Merge pull request #1223 from NateWardawg/master
1: File path in save dialog automatically appended with correct extension if not manually added by the user. 2: Removed .bin as default extension for Linux exports as it causes problems for common file managers.
Diffstat (limited to 'scene/gui/file_dialog.cpp')
-rw-r--r-- | scene/gui/file_dialog.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index a7ff1431bd..fbcfdb69bb 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -156,7 +156,6 @@ void FileDialog::_action_pressed() { if (mode==MODE_SAVE_FILE) { - String ext = f.extension(); bool valid=false; if (filter->get_selected()==filter->get_item_count()-1) { @@ -184,7 +183,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 +192,13 @@ void FileDialog::_action_pressed() { break; } } + + if (!valid && filterSliceCount>0) { + String str = (flt.get_slice(",",0).strip_edges()); + f+=str.substr(1, str.length()-1); + file->set_text(f.get_file()); + valid=true; + } } else { valid=true; } |