From 9968843d1751540d3ad10c5192f24a132daca106 Mon Sep 17 00:00:00 2001 From: Matt Gleason Date: Wed, 21 Jun 2023 18:31:51 -0500 Subject: [PATCH] SFT-2121: allowed recovery from root directory, only if a backup is present --- .../Passport/modules/flows/restore_backup_flow.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ports/stm32/boards/Passport/modules/flows/restore_backup_flow.py b/ports/stm32/boards/Passport/modules/flows/restore_backup_flow.py index 7ae584f56..c3b62091a 100644 --- a/ports/stm32/boards/Passport/modules/flows/restore_backup_flow.py +++ b/ports/stm32/boards/Passport/modules/flows/restore_backup_flow.py @@ -52,7 +52,18 @@ async def check_if_erased(self): self.goto(self.choose_file) async def choose_file(self): - result = await FilePickerFlow(suffix='.7z', show_folders=True).run() + from utils import get_file_list, get_backups_folder_path + + suffix = '.7z' + files = get_file_list(suffix=suffix) + if len(files) == 0: + initial_path = get_backups_folder_path() + else: + initial_path = None + + result = await FilePickerFlow(initial_path=initial_path, + suffix=suffix, + show_folders=True).run() if result is None: # No file chosen, so go back to menu self.set_result(False)