Fix regression causing failure to start if one of the previously used libraries no longer exists. Fixes #1907773 [After Update 5.7 - Defect by Start](https://bugs.launchpad.net/calibre/+bug/1907773)

This commit is contained in:
Kovid Goyal 2020-12-11 13:40:52 +05:30
parent 9e09d44aca
commit c6d738ef6d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -65,11 +65,14 @@ def library_id_from_path(path, existing=frozenset()):
def correct_case_of_last_path_component(original_path):
prefix, basename = os.path.split(original_path)
q = basename.lower()
equals = tuple(x for x in os.listdir(prefix) if x.lower() == q)
try:
equals = tuple(x for x in os.listdir(prefix) if x.lower() == q)
except OSError:
equals = ()
if len(equals) > 1:
if basename not in equals:
basename = equals[0]
else:
elif equals:
basename = equals[0]
return os.path.join(prefix, basename)