mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-18 05:33:59 +00:00
PICARD-214: Fix Picard adding numbers on file rename on case insensitive file systems
If a file got renamed and the only change was in casing Picard would append a number on case insensitive file systems (except on Windows). Use os.path.samefile to properly check if the old and new path refer to the same file.
This commit is contained in:
@@ -75,7 +75,6 @@ from picard.util import (
|
||||
emptydir,
|
||||
find_best_match,
|
||||
format_time,
|
||||
pathcmp,
|
||||
thread,
|
||||
tracknum_from_filename,
|
||||
)
|
||||
@@ -485,8 +484,8 @@ class File(QtCore.QObject, Item):
|
||||
os.makedirs(new_dirname)
|
||||
tmp_filename = new_filename
|
||||
i = 1
|
||||
while (not pathcmp(old_filename, new_filename + ext)
|
||||
and os.path.exists(new_filename + ext)):
|
||||
while (os.path.exists(new_filename + ext)
|
||||
and not os.path.samefile(old_filename, new_filename + ext)):
|
||||
new_filename = "%s (%d)" % (tmp_filename, i)
|
||||
i += 1
|
||||
new_filename = new_filename + ext
|
||||
|
||||
Reference in New Issue
Block a user