mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
if media is off, don't upgrade it
This commit is contained in:
parent
53cd0c5b9f
commit
8122c42245
2 changed files with 13 additions and 10 deletions
|
@ -20,6 +20,7 @@ class MediaManager(object):
|
||||||
def __init__(self, col, server):
|
def __init__(self, col, server):
|
||||||
self.col = col
|
self.col = col
|
||||||
if server:
|
if server:
|
||||||
|
self._dir = None
|
||||||
return
|
return
|
||||||
# media directory
|
# media directory
|
||||||
self._dir = re.sub("(?i)\.(anki2)$", ".media", self.col.path)
|
self._dir = re.sub("(?i)\.(anki2)$", ".media", self.col.path)
|
||||||
|
|
|
@ -124,6 +124,8 @@ def _upgrade(col, ver):
|
||||||
# adding an empty file to a zip makes python's zip code think it's a
|
# adding an empty file to a zip makes python's zip code think it's a
|
||||||
# folder, so remove any empty files
|
# folder, so remove any empty files
|
||||||
changed = False
|
changed = False
|
||||||
|
dir = col.media.dir()
|
||||||
|
if dir:
|
||||||
for f in os.listdir(col.media.dir()):
|
for f in os.listdir(col.media.dir()):
|
||||||
if os.path.isfile(f) and not os.path.getsize(f):
|
if os.path.isfile(f) and not os.path.getsize(f):
|
||||||
os.unlink(f)
|
os.unlink(f)
|
||||||
|
|
Loading…
Reference in a new issue