create backup dir if missing

This commit is contained in:
Damien Elmes 2010-02-20 09:54:54 +09:00
parent 7c8e612704
commit bc345d3711

View file

@ -3353,6 +3353,11 @@ nextFactor, reps, thinkingTime, yesCount, noCount from reviewHistory""")
path = path.replace(":", "") path = path.replace(":", "")
return path return path
escp = escape(path) escp = escape(path)
# make sure backup dir exists
try:
os.makedirs(backupDir)
except (OSError, IOError):
pass
# find existing backups # find existing backups
gen = re.sub("\.anki$", ".backup-(\d+).anki", re.escape(escp)) gen = re.sub("\.anki$", ".backup-(\d+).anki", re.escape(escp))
backups = [] backups = []