From 2aecbffafe9b826dba7af7d1d07d9b43d3295f56 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 5 Jan 2009 06:51:47 +0900 Subject: [PATCH] fix backup on win32 --- anki/deck.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/anki/deck.py b/anki/deck.py index 2beac2292..3db37d36e 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -2184,23 +2184,17 @@ where interval < 1""") _setUTCOffset = staticmethod(_setUTCOffset) def backup(modified, path): - try: - os.makedirs(backupDir) - except OSError: - pass # need a non-unicode path - path = path.encode(sys.getfilesystemencoding()) - bdir = backupDir.encode(sys.getfilesystemencoding()) def backupName(path, num): path = os.path.abspath(path) path = path.replace("\\", "!") path = path.replace("/", "!") path = path.replace(":", "") - path = os.path.join(bdir, path) + path = os.path.join(backupDir, path) path = re.sub("\.anki$", ".backup-%d.anki" % num, path) return path - if not os.path.exists(bdir): - os.makedirs(bdir) + if not os.path.exists(backupDir): + os.makedirs(backupDir) # if the mod time is identical, don't make a new backup firstBack = backupName(path, 0) if os.path.exists(firstBack):