send to trash when deleting profile

This commit is contained in:
Damien Elmes 2013-05-23 14:03:21 +09:00
parent 2655dcf649
commit aa0cac1ed3

View File

@ -14,6 +14,7 @@ from anki.lang import langs
from aqt.utils import showWarning
from aqt import appHelpSite
import aqt.forms
from send2trash import send2trash
metaConf = dict(
ver=0,
@ -120,7 +121,9 @@ documentation for information on using a flash drive.""")
self.db.commit()
def remove(self, name):
shutil.rmtree(self.profileFolder())
p = self.profileFolder()
if os.path.exists(p):
send2trash(p)
self.db.execute("delete from profiles where name = ?",
name.encode("utf8"))
self.db.commit()