ソースを参照

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.
Juan Linietsky 10 年 前
コミット
07e63c3dc1
2 ファイル変更10 行追加3 行削除
  1. 1 1
      platform/x11/export/export.cpp
  2. 9 2
      scene/gui/file_dialog.cpp

+ 1 - 1
platform/x11/export/export.cpp

@@ -11,7 +11,7 @@ void register_x11_exporter() {
 
 	{
 		Ref<EditorExportPlatformPC> exporter = Ref<EditorExportPlatformPC>( memnew(EditorExportPlatformPC) );
-		exporter->set_binary_extension("bin");
+		exporter->set_binary_extension("");
 		exporter->set_release_binary32("linux_x11_32_release");
 		exporter->set_debug_binary32("linux_x11_32_debug");
 		exporter->set_release_binary64("linux_x11_64_release");

+ 9 - 2
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;
 			}