Avoid extra roundtrip to filesystem

This commit is contained in:
Kovid Goyal 2020-11-09 10:06:41 +05:30
parent 5799e93703
commit 7bfe9e3e1a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -126,7 +126,7 @@ def is_case_sensitive(path):
name1, name2 = ('calibre_test_case_sensitivity.txt',
'calibre_TesT_CaSe_sensitiVitY.Txt')
f1, f2 = os.path.join(path, name1), os.path.join(path, name2)
if os.path.exists(f1):
with suppress(OSError):
os.remove(f1)
open(f1, 'w').close()
is_case_sensitive = not os.path.exists(f2)