mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Fix some font directories from fonts.conf being ignored on linux when scanning the system for installed fonts. Fixes #1339257 [some font directories are ignored](https://bugs.launchpad.net/calibre/+bug/1339257)
This commit is contained in:
parent
4b20fbbf10
commit
da29398a26
@ -78,15 +78,20 @@ def fc_list():
|
||||
end(str_list)
|
||||
if len(ans) < 3:
|
||||
return default_font_dirs()
|
||||
parents = []
|
||||
|
||||
parents, visited = [], set()
|
||||
for f in ans:
|
||||
found = False
|
||||
for p in parents:
|
||||
if f.startswith(p):
|
||||
found = True
|
||||
path = os.path.normpath(os.path.abspath(os.path.realpath(f)))
|
||||
if path == '/':
|
||||
continue
|
||||
head, tail = os.path.split(path)
|
||||
while head and tail:
|
||||
if head in visited:
|
||||
break
|
||||
if not found:
|
||||
parents.append(f)
|
||||
head, tail = os.path.split(head)
|
||||
else:
|
||||
parents.append(path)
|
||||
visited.add(path)
|
||||
return parents
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user