Skip to content

Commit

Permalink
Fix issue with save file dialog taking the name of the first file it …
Browse files Browse the repository at this point in the history
…sees

Instead of using the project's name. This could've caused issues if the user accidentally replaced the previous file.
  • Loading branch information
OverloadedOrama committed Jul 7, 2022
1 parent f8c7494 commit 5d65e82
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/UI/TopMenuContainer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -357,32 +357,34 @@ func _on_open_last_project_file_menu_option_pressed() -> void:

func _save_project_file() -> void:
Global.control.is_quitting_on_save = false
var path = OpenSave.current_save_paths[Global.current_project_index]
var path: String = OpenSave.current_save_paths[Global.current_project_index]
if path == "":
Global.dialog_open(true)
if OS.get_name() == "HTML5":
var save_dialog: ConfirmationDialog = Global.save_sprites_html5_dialog
var save_filename = save_dialog.get_node("FileNameContainer/FileNameLineEdit")
save_dialog.popup_centered()
save_filename.text = Global.current_project.name
else:
Global.save_sprites_dialog.popup_centered()
Global.save_sprites_dialog.current_file = Global.current_project.name
Global.dialog_open(true)
yield(get_tree(), "idle_frame")
Global.save_sprites_dialog.get_line_edit().text = Global.current_project.name
else:
Global.control.save_project(path)


func _save_project_file_as() -> void:
Global.control.is_quitting_on_save = false
Global.dialog_open(true)
if OS.get_name() == "HTML5":
var save_dialog: ConfirmationDialog = Global.save_sprites_html5_dialog
var save_filename = save_dialog.get_node("FileNameContainer/FileNameLineEdit")
save_dialog.popup_centered()
save_filename.text = Global.current_project.name
else:
Global.save_sprites_dialog.popup_centered()
Global.save_sprites_dialog.current_file = Global.current_project.name
Global.dialog_open(true)
yield(get_tree(), "idle_frame")
Global.save_sprites_dialog.get_line_edit().text = Global.current_project.name


func _export_file() -> void:
Expand Down

0 comments on commit 5d65e82

Please sign in to comment.