From bc345d371190d0baebc5dfa4ddade3e12f96a234 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 20 Feb 2010 09:54:54 +0900 Subject: [PATCH] create backup dir if missing --- anki/deck.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/anki/deck.py b/anki/deck.py index 3c685401a..4b12fa328 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -3353,6 +3353,11 @@ nextFactor, reps, thinkingTime, yesCount, noCount from reviewHistory""") path = path.replace(":", "") return path escp = escape(path) + # make sure backup dir exists + try: + os.makedirs(backupDir) + except (OSError, IOError): + pass # find existing backups gen = re.sub("\.anki$", ".backup-(\d+).anki", re.escape(escp)) backups = []