Real name changes (not simplly change of case) raised an exception. Fix that.

This commit is contained in:
Charles Haley 2010-08-12 12:17:44 +01:00
parent 2a50706fab
commit 10554d0d4d

View File

@ -440,12 +440,12 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
# system. This can lead to having the directory names not match the # system. This can lead to having the directory names not match the
# title/author, which leads to trouble when libraries are copied to # title/author, which leads to trouble when libraries are copied to
# a case-sensitive system. The following code fixes this by checking # a case-sensitive system. The following code fixes this by checking
# each segment. If they are different (must be because of case), # each segment. If they are different because of case, then rename
# then rename the segment to some temp file name, then rename it # the segment to some temp file name, then rename it back to the
# back to the correct name. Note that the code above correctly # correct name. Note that the code above correctly handles files in
# handles files in the directories, so no need to do them here. # the directories, so no need to do them here.
for oldseg,newseg in zip(current_path.split('/'), path.split('/')): for oldseg,newseg in zip(current_path.split('/'), path.split('/')):
if oldseg != newseg: if oldseg.lower() == newseg.lower() and oldseg != newseg:
while True: while True:
# need a temp name in the current segment for renames # need a temp name in the current segment for renames
tempname = 'TEMP.%f'%time.time() tempname = 'TEMP.%f'%time.time()