mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 01:29:49 +00:00
parent
7416ed375c
commit
9ae93a1387
|
@ -214,7 +214,7 @@ func save_pxo_file(
|
|||
autosave: bool,
|
||||
use_zstd_compression := true,
|
||||
project: Project = Global.current_project
|
||||
) -> void:
|
||||
) -> bool:
|
||||
if !autosave:
|
||||
project.name = path.get_file()
|
||||
var serialized_data := project.serialize()
|
||||
|
@ -224,7 +224,7 @@ func save_pxo_file(
|
|||
)
|
||||
Global.error_dialog.popup_centered()
|
||||
Global.dialog_open(true)
|
||||
return
|
||||
return false
|
||||
var to_save := JSON.print(serialized_data)
|
||||
if !to_save:
|
||||
Global.error_dialog.set_text(
|
||||
|
@ -232,7 +232,7 @@ func save_pxo_file(
|
|||
)
|
||||
Global.error_dialog.popup_centered()
|
||||
Global.dialog_open(true)
|
||||
return
|
||||
return false
|
||||
|
||||
# Check if a file with the same name exists. If it does, rename the new file temporarily.
|
||||
# Needed in case of a crash, so that the old file won't be replaced with an empty one.
|
||||
|
@ -250,14 +250,15 @@ func save_pxo_file(
|
|||
|
||||
if err != OK:
|
||||
if temp_path.is_valid_filename():
|
||||
return
|
||||
return false
|
||||
Global.error_dialog.set_text(
|
||||
tr("File failed to save. Error code %s") % str(err, ErrorManager.parse(err, " (", ")"))
|
||||
)
|
||||
Global.error_dialog.popup_centered()
|
||||
Global.dialog_open(true)
|
||||
file.close()
|
||||
return
|
||||
if file: # Failsafe
|
||||
file.close()
|
||||
return false
|
||||
|
||||
if !autosave:
|
||||
current_save_paths[Global.current_project_index] = path
|
||||
|
@ -308,6 +309,7 @@ func save_pxo_file(
|
|||
)
|
||||
|
||||
save_project_to_recent_list(path)
|
||||
return true
|
||||
|
||||
|
||||
func open_image_as_new_tab(path: String, image: Image) -> void:
|
||||
|
|
11
src/Main.gd
11
src/Main.gd
|
@ -287,12 +287,13 @@ func _on_SaveSprite_file_selected(path: String) -> void:
|
|||
|
||||
func save_project(path: String) -> void:
|
||||
var zstd: bool = Global.save_sprites_dialog.get_vbox().get_node("ZSTDCompression").pressed
|
||||
OpenSave.save_pxo_file(path, false, zstd)
|
||||
Global.open_sprites_dialog.current_dir = path.get_base_dir()
|
||||
Global.config_cache.set_value("data", "current_dir", path.get_base_dir())
|
||||
var success = OpenSave.save_pxo_file(path, false, zstd)
|
||||
if success:
|
||||
Global.open_sprites_dialog.current_dir = path.get_base_dir()
|
||||
Global.config_cache.set_value("data", "current_dir", path.get_base_dir())
|
||||
|
||||
if is_quitting_on_save:
|
||||
_quit()
|
||||
if is_quitting_on_save:
|
||||
_quit()
|
||||
|
||||
|
||||
func _on_SaveSpriteHTML5_confirmed() -> void:
|
||||
|
|
Loading…
Reference in a new issue