From daeba6f78b42455dc2dc5d650ae3f5e60681bc94 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 13 Dec 2008 16:44:59 +0900 Subject: [PATCH] fix a problem saving over a deck with an existing media folder --- anki/deck.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/anki/deck.py b/anki/deck.py index c1913720b..d3c9873af 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -1369,8 +1369,13 @@ Return new path, relative to media dir.""" assert os.path.exists(oldPath) newPath = self.mediaDir(create=True) # copytree doesn't want the dir to exist - os.rmdir(newPath) - shutil.copytree(oldPath, newPath) + try: + os.rmdir(newPath) + shutil.copytree(oldPath, newPath) + except: + # FIXME: should really remove everything in old dir instead of + # giving up + pass # DB helpers ##########################################################################