Skip to content

Commit 343e0db

Browse files
committed
Fix backup
When you create a new backup, old one will now be deleted
1 parent 7bf9c71 commit 343e0db

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

save-editor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ def main():
189189
operation_choice = input("Enter your choice: ")
190190

191191
if operation_choice == "1":
192+
if os.path.exists(backup_file_path): # delete existing backup file if it exists
193+
os.remove(backup_file_path)
192194
with open(save_file_path, 'r') as original: data = original.read()
193195
with open(backup_file_path, 'w') as backup: backup.write(data)
194196
print("Backup created.")

0 commit comments

Comments
 (0)