From 7d2f359a0c5ec72d07f95491baa698b800b04069 Mon Sep 17 00:00:00 2001 From: Nathan Warden Date: Wed, 14 Jan 2015 18:02:51 -0500 Subject: File path in save dialog automatically appended with correct extension if not manually added by the user. --- scene/gui/file_dialog.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'scene') 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 && idx0) { + String str = (flt.get_slice(",",0).strip_edges()); + f+=str.substr(1, str.length()-1); + valid=true; + } } else { valid=true; } -- cgit v1.2.3 From cac555dc78047b96486d5c52e990c7dde62f0a6b Mon Sep 17 00:00:00 2001 From: Nathan Warden Date: Fri, 16 Jan 2015 07:48:28 -0500 Subject: When overwriting a file with an auto added extension the file name is now set correctly. --- scene/gui/file_dialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scene') diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index a98cb841dc..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) { @@ -197,6 +196,7 @@ void FileDialog::_action_pressed() { 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 { -- cgit v1.2.3