Skip to content

Commit

Permalink
Fix backup
Browse files Browse the repository at this point in the history
When you create a new backup, old one will now be deleted
  • Loading branch information
Aholicknight committed Dec 3, 2023
1 parent 7bf9c71 commit 343e0db
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions save-editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ def main():
operation_choice = input("Enter your choice: ")

if operation_choice == "1":
if os.path.exists(backup_file_path): # delete existing backup file if it exists
os.remove(backup_file_path)
with open(save_file_path, 'r') as original: data = original.read()
with open(backup_file_path, 'w') as backup: backup.write(data)
print("Backup created.")
Expand Down

0 comments on commit 343e0db

Please sign in to comment.