1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-30 23:19:49 +00:00

Remove duplicate code in Main's load_last_project()

This commit is contained in:
Emmanouil Papadeas 2024-03-22 14:44:11 +02:00
parent 6c8b2ae36b
commit 60af6b27e3

View file

@ -254,21 +254,12 @@ func load_last_project() -> void:
if Global.config_cache.has_section_key("data", "last_project_path"):
# Check if file still exists on disk
var file_path = Global.config_cache.get_value("data", "last_project_path")
if FileAccess.file_exists(file_path): # If yes then load the file
OpenSave.open_pxo_file(file_path)
# Sync file dialogs
Global.save_sprites_dialog.current_dir = file_path.get_base_dir()
Global.open_sprites_dialog.current_dir = file_path.get_base_dir()
Global.config_cache.set_value("data", "current_dir", file_path.get_base_dir())
else:
# If file doesn't exist on disk then warn user about this
Global.popup_error("Cannot find last project file.")
load_recent_project_file(file_path)
func load_recent_project_file(path: String) -> void:
if OS.get_name() == "Web":
return
# Check if file still exists on disk
if FileAccess.file_exists(path): # If yes then load the file
OpenSave.handle_loading_file(path)