mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 06:07:11 -05:00
when files have been modified, make sure to retain originalPath
This commit is contained in:
parent
670439c805
commit
932440165a
1 changed files with 11 additions and 0 deletions
|
|
@ -73,6 +73,17 @@ Update media table. If file already exists, don't copy."""
|
|||
if not deck.s.scalar(
|
||||
"select 1 from media where filename = :f",
|
||||
f=newBase):
|
||||
if description != "latex":
|
||||
# if the user has modified a hashed file, try to remember the old
|
||||
# filename
|
||||
old = deck.s.scalar(
|
||||
"select originalPath from media where filename = :s",
|
||||
s=os.path.basename(origPath))
|
||||
if old:
|
||||
origPath = old
|
||||
description = os.path.splitext(os.path.basename(origPath))[0]
|
||||
print "orig", old
|
||||
print "desc", description
|
||||
try:
|
||||
path = unicode(path, sys.getfilesystemencoding())
|
||||
except TypeError:
|
||||
|
|
|
|||
Loading…
Reference in a new issue