mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
possible fix for case insensitive filenames
This commit is contained in:
parent
1ee40d0869
commit
1877bc6769
1 changed files with 5 additions and 1 deletions
|
@ -58,6 +58,10 @@ Update media table. If file already exists, don't copy."""
|
||||||
new = os.path.join(deck.mediaDir(create=True), newBase)
|
new = os.path.join(deck.mediaDir(create=True), newBase)
|
||||||
# copy if not existing
|
# copy if not existing
|
||||||
if not os.path.exists(new):
|
if not os.path.exists(new):
|
||||||
|
if new.lower() == path.lower():
|
||||||
|
# case insensitive filesystems suck
|
||||||
|
os.rename(path, new.encode(sys.getfilesystemencoding()))
|
||||||
|
else:
|
||||||
shutil.copy2(path, new.encode(sys.getfilesystemencoding()))
|
shutil.copy2(path, new.encode(sys.getfilesystemencoding()))
|
||||||
newSize = os.stat(new)[stat.ST_SIZE]
|
newSize = os.stat(new)[stat.ST_SIZE]
|
||||||
if not deck.s.scalar(
|
if not deck.s.scalar(
|
||||||
|
|
Loading…
Reference in a new issue