diff --git a/pyimage_ui/actions.py b/pyimage_ui/actions.py index 213c66b..c359305 100644 --- a/pyimage_ui/actions.py +++ b/pyimage_ui/actions.py @@ -35,12 +35,24 @@ class Actions: full_backup_exists = False if self.app.destination_path and os.path.isdir(self.app.destination_path): - system_backups = self.app.backup_manager.list_system_backups( - self.app.destination_path) - for backup in system_backups: - if backup.get('backup_type_base') == 'Full': - full_backup_exists = True - break + pybackup_dir = os.path.join(self.app.destination_path, "pybackup") + encrypted_container = os.path.join(pybackup_dir, "pybackup_encrypted.luks") + + if os.path.exists(encrypted_container): + # If an encrypted container exists, we check for any directory inside the pybackup folder. + # The presence of any item other than the .luks file and its .txt info file suggests a backup has been made. + if os.path.isdir(pybackup_dir): + for item in os.listdir(pybackup_dir): + if not item.endswith(('.luks', '.txt')) and os.path.isdir(os.path.join(pybackup_dir, item)): + full_backup_exists = True + break + else: + # For non-encrypted backups, check for a directory that represents a full backup. + system_backups = self.app.backup_manager.list_system_backups(pybackup_dir) + for backup in system_backups: + if backup.get('backup_type_base') == 'Full': + full_backup_exists = True + break if full_backup_exists: self._set_backup_type("incremental")