mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
work around osx decomposing files on HFS+ partitions. sigh.
This commit is contained in:
parent
eec317bfc3
commit
31df2fac01
1 changed files with 3 additions and 1 deletions
|
@ -8,7 +8,7 @@ Media support
|
||||||
"""
|
"""
|
||||||
__docformat__ = 'restructuredtext'
|
__docformat__ = 'restructuredtext'
|
||||||
|
|
||||||
import os, shutil, re, urllib2, time, tempfile
|
import os, shutil, re, urllib2, time, tempfile, unicodedata
|
||||||
from anki.db import *
|
from anki.db import *
|
||||||
from anki.utils import checksum, genID
|
from anki.utils import checksum, genID
|
||||||
from anki.lang import _
|
from anki.lang import _
|
||||||
|
@ -147,6 +147,7 @@ def rebuildMediaDir(deck, delete=False, dirty=True):
|
||||||
"select question, answer from cards"):
|
"select question, answer from cards"):
|
||||||
for txt in (question, answer):
|
for txt in (question, answer):
|
||||||
for f in mediaFiles(txt):
|
for f in mediaFiles(txt):
|
||||||
|
f = unicodedata.normalize('NFD', f)
|
||||||
if f in refs:
|
if f in refs:
|
||||||
refs[f] += 1
|
refs[f] += 1
|
||||||
else:
|
else:
|
||||||
|
@ -161,6 +162,7 @@ def rebuildMediaDir(deck, delete=False, dirty=True):
|
||||||
if not os.path.isfile(path):
|
if not os.path.isfile(path):
|
||||||
# ignore directories
|
# ignore directories
|
||||||
continue
|
continue
|
||||||
|
file = unicodedata.normalize('NFD', file)
|
||||||
if file not in refs:
|
if file not in refs:
|
||||||
unused.append(file)
|
unused.append(file)
|
||||||
# optionally delete
|
# optionally delete
|
||||||
|
|
Loading…
Reference in a new issue