mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -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)
|
end(str_list)
|
||||||
if len(ans) < 3:
|
if len(ans) < 3:
|
||||||
return default_font_dirs()
|
return default_font_dirs()
|
||||||
parents = []
|
|
||||||
|
parents, visited = [], set()
|
||||||
for f in ans:
|
for f in ans:
|
||||||
found = False
|
path = os.path.normpath(os.path.abspath(os.path.realpath(f)))
|
||||||
for p in parents:
|
if path == '/':
|
||||||
if f.startswith(p):
|
continue
|
||||||
found = True
|
head, tail = os.path.split(path)
|
||||||
|
while head and tail:
|
||||||
|
if head in visited:
|
||||||
break
|
break
|
||||||
if not found:
|
head, tail = os.path.split(head)
|
||||||
parents.append(f)
|
else:
|
||||||
|
parents.append(path)
|
||||||
|
visited.add(path)
|
||||||
return parents
|
return parents
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user