From 9a313821dc8baed68346f14d3fe60a3c9e12592a Mon Sep 17 00:00:00 2001
From: Emmanouil Papadeas <manoschool@yahoo.gr>
Date: Thu, 15 Feb 2024 18:41:24 +0200
Subject: [PATCH] When exporting, Pixelorama now remembers the last exported
 path

---
 Translations/Translations.pot |  8 ++++++++
 src/Autoload/Export.gd        | 11 +++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/Translations/Translations.pot b/Translations/Translations.pot
index 1a3f235b3..1522c3790 100644
--- a/Translations/Translations.pot
+++ b/Translations/Translations.pot
@@ -298,6 +298,10 @@ msgstr ""
 msgid "Rename Layout"
 msgstr ""
 
+#. Refers to the current layout of the user interface.
+msgid "Current layout"
+msgstr ""
+
 msgid "Are you sure you want to delete this layout?"
 msgstr ""
 
@@ -2128,6 +2132,10 @@ msgstr ""
 msgid "File failed to save. Error code %s"
 msgstr ""
 
+#. Appears when the user attempts to export a project as a video, but the process fails. FFMPEG is the external software used to export videos.
+msgid "Video failed to export. Ensure that FFMPEG is installed correctly."
+msgstr ""
+
 msgid "File(s) exported"
 msgstr ""
 
diff --git a/src/Autoload/Export.gd b/src/Autoload/Export.gd
index ebe46d711..de4e45fd4 100644
--- a/src/Autoload/Export.gd
+++ b/src/Autoload/Export.gd
@@ -279,6 +279,9 @@ func export_processed_images(
 		if is_using_ffmpeg(project.file_format):
 			var video_exported := export_video(export_paths)
 			if not video_exported:
+				Global.popup_error(
+					tr("Video failed to export. Ensure that FFMPEG is installed correctly.")
+				)
 				return false
 		else:
 			var exporter: AImgIOBaseExporter
@@ -299,7 +302,6 @@ func export_processed_images(
 					gif_export_thread.wait_to_finish()
 				gif_export_thread.start(export_animated.bind(details))
 	else:
-		var succeeded := true
 		for i in range(processed_images.size()):
 			if OS.has_feature("web"):
 				if project.file_format == FileFormat.PNG:
@@ -333,10 +335,9 @@ func export_processed_images(
 					Global.popup_error(
 						tr("File failed to save. Error code %s (%s)") % [err, error_string(err)]
 					)
-					succeeded = false
-		if succeeded:
-			Global.notification_label("File(s) exported")
+					return false
 
+	Global.notification_label("File(s) exported")
 	# Store settings for quick export and when the dialog is opened again
 	var file_name_with_ext := project.file_name + file_format_string(project.file_format)
 	project.was_exported = true
@@ -348,6 +349,8 @@ func export_processed_images(
 		Global.top_menu_container.file_menu.set_item_text(
 			Global.FileMenu.EXPORT, tr("Export") + " %s" % file_name_with_ext
 		)
+	project.directory_path = export_paths[0].get_base_dir()
+	Global.config_cache.set_value("data", "current_dir", project.directory_path)
 	return true