summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobbie Cooper <cooperra@users.noreply.github.com>2017-10-28 04:57:29 -0400
committerAndreas Haas <liu.gam3@gmail.com>2017-11-20 23:20:56 +0100
commit24fe3bd605957ce803c0641a469dc3242c242238 (patch)
treea55666cba8fbc89bc9eecf86267889c8cfec9b01
parent71a3e71b61690663f5bc6b1b091f578a6d6915f7 (diff)
Fix file extensions persisting in file dialog after export
This caused issues if one decided to export many formats in a row. The new file extension would be appended to the previous one. Now, the filename is retained without its extension for successive exports. Fixes #7291
-rw-r--r--editor/project_export.cpp6
-rw-r--r--editor/project_export.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index dda2851166..6500b10a3a 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -717,6 +717,7 @@ void ProjectExportDialog::_export_project() {
export_project->set_access(FileDialog::ACCESS_FILESYSTEM);
export_project->clear_filters();
+ export_project->set_current_file(default_filename);
String extension = platform->get_binary_extension();
if (extension != String()) {
export_project->add_filter("*." + extension + " ; " + platform->get_name() + " Export");
@@ -726,6 +727,9 @@ void ProjectExportDialog::_export_project() {
}
void ProjectExportDialog::_export_project_to_path(const String &p_path) {
+ // Save this name for use in future exports (but drop the file extension)
+ default_filename = p_path.get_basename().get_file();
+ EditorSettings::get_singleton()->set_project_metadata("export_options", "default_filename", default_filename);
Ref<EditorExportPreset> current = EditorExport::get_singleton()->get_export_preset(presets->get_current());
ERR_FAIL_COND(current.is_null());
@@ -970,6 +974,8 @@ ProjectExportDialog::ProjectExportDialog() {
set_hide_on_ok(false);
editor_icons = "EditorIcons";
+
+ default_filename = EditorSettings::get_singleton()->get_project_metadata("export_options", "default_filename", String());
}
ProjectExportDialog::~ProjectExportDialog() {
diff --git a/editor/project_export.h b/editor/project_export.h
index 288b0c290f..b258112fa8 100644
--- a/editor/project_export.h
+++ b/editor/project_export.h
@@ -99,6 +99,8 @@ private:
Label *export_error;
HBoxContainer *export_templates_error;
+ String default_filename;
+
void _patch_selected(const String &p_path);
void _patch_deleted();