From eb1793ba384c6e666df4b7f9f31917b566894519 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 23 May 2013 14:04:40 +0900 Subject: [PATCH] send old backups to trash as well --- aqt/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aqt/main.py b/aqt/main.py index 1995c4b12..fa543ab2c 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -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()