mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Remove duplicate code in Main's load_last_project()
This commit is contained in:
parent
6c8b2ae36b
commit
60af6b27e3
11
src/Main.gd
11
src/Main.gd
|
@ -254,21 +254,12 @@ func load_last_project() -> void:
|
||||||
if Global.config_cache.has_section_key("data", "last_project_path"):
|
if Global.config_cache.has_section_key("data", "last_project_path"):
|
||||||
# Check if file still exists on disk
|
# Check if file still exists on disk
|
||||||
var file_path = Global.config_cache.get_value("data", "last_project_path")
|
var file_path = Global.config_cache.get_value("data", "last_project_path")
|
||||||
if FileAccess.file_exists(file_path): # If yes then load the file
|
load_recent_project_file(file_path)
|
||||||
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.")
|
|
||||||
|
|
||||||
|
|
||||||
func load_recent_project_file(path: String) -> void:
|
func load_recent_project_file(path: String) -> void:
|
||||||
if OS.get_name() == "Web":
|
if OS.get_name() == "Web":
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check if file still exists on disk
|
# Check if file still exists on disk
|
||||||
if FileAccess.file_exists(path): # If yes then load the file
|
if FileAccess.file_exists(path): # If yes then load the file
|
||||||
OpenSave.handle_loading_file(path)
|
OpenSave.handle_loading_file(path)
|
||||||
|
|
Loading…
Reference in a new issue