File tree 1 file changed +18
-3
lines changed
1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -702,16 +702,31 @@ def auto_save_project(self):
702
702
703
703
# Delete recovery files which are 'too old'
704
704
for backup_filepath in old_backup_files :
705
- os .unlink (backup_filepath )
705
+ try :
706
+ if os .path .exists (backup_filepath ):
707
+ os .unlink (backup_filepath )
708
+ log .info (f"Deleted backup file: { backup_filepath } " )
709
+ else :
710
+ log .warning (f"File not found: { backup_filepath } " )
711
+ except PermissionError :
712
+ log .warning (f"Permission denied: { backup_filepath } . Unable to delete." )
713
+ except Exception as e :
714
+ log .error (f"Error deleting file { backup_filepath } : { e } " , exc_info = True )
706
715
707
716
# Save project
708
717
log .info ("Auto save project file: %s" , file_path )
709
718
self .save_project (file_path )
710
719
711
720
# Remove backup.osp (if any)
712
721
if os .path .exists (info .BACKUP_FILE ):
713
- # Delete backup.osp since we just saved the actual project
714
- os .unlink (info .BACKUP_FILE )
722
+ try :
723
+ # Delete backup.osp since we just saved the actual project
724
+ os .unlink (info .BACKUP_FILE )
725
+ log .info (f"Deleted backup file: { info .BACKUP_FILE } " )
726
+ except PermissionError :
727
+ log .warning (f"Permission denied: { info .BACKUP_FILE } . Unable to delete." )
728
+ except Exception as e :
729
+ log .error (f"Error deleting file { info .BACKUP_FILE } : { e } " , exc_info = True )
715
730
716
731
else :
717
732
# No saved project found
You can’t perform that action at this time.
0 commit comments