send old backups to trash as well

This commit is contained in:
Damien Elmes 2013-05-23 14:04:40 +09:00
parent aa0cac1ed3
commit eb1793ba38

View File

@ -2,9 +2,9 @@
# -*- coding: utf-8 -*-
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import os, sys, re, traceback, signal, send2trash
import os, sys, re, traceback, signal
import zipfile
from send2trash import send2trash
from aqt.qt import *
from anki import Collection
@ -328,7 +328,7 @@ the manual for information on how to restore from an automatic backup."))
delete = len(backups) + 1 - nbacks
delete = backups[:delete]
for file in delete:
os.unlink(os.path.join(dir, file[1]))
send2trash(os.path.join(dir, file[1]))
def maybeOptimize(self):
# have two weeks passed?
@ -923,7 +923,7 @@ will be lost. Continue?"""))
mdir = self.col.media.dir()
for f in unused:
path = os.path.join(mdir, f)
send2trash.send2trash(path)
send2trash(path)
tooltip(_("Deleted."))
diag.close()