From 4f9a18ced3f0be97e2ca811cb57ba053d1535927 Mon Sep 17 00:00:00 2001
From: Kelly W <kellymwhitehead@gmail.com>
Date: Thu, 12 Dec 2024 16:43:08 -0800
Subject: [PATCH] housekeeping: fix last project shortcut

---
 src/qris_toolbar.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/qris_toolbar.py b/src/qris_toolbar.py
index 464366b..556f700 100644
--- a/src/qris_toolbar.py
+++ b/src/qris_toolbar.py
@@ -340,7 +340,13 @@ def run(self):
             settings = QtCore.QSettings(ORGANIZATION, APPNAME)
             last_project_folder = settings.value(LAST_PROJECT_FOLDER)
             if last_project_folder is not None and os.path.isdir(last_project_folder):
-                project_file = os.path.join(last_project_folder, f'{os.path.basename(last_project_folder)}.gpkg')
+                # find the project gpkg file in the last project folder only
+                project_file = None
+                for file in os.listdir(last_project_folder):
+                    if file.endswith('.gpkg'):
+                        project_file = os.path.join(last_project_folder, file)
+                        break
+                # project_file = os.path.join(last_project_folder, f'{os.path.basename(last_project_folder)}.gpkg')
                 if os.path.isfile(project_file):
                     self.open_qris_project(project_file)