Font scanner: Also scan the new win 10 local font paths

Fixes #1888798 [Additional Windows 10 font directory location (v 1809)](https://bugs.launchpad.net/calibre/+bug/1888798)
This commit is contained in:
Kovid Goyal 2020-07-24 13:03:52 +05:30
parent 742187742a
commit 9b386b6a46
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -103,10 +103,16 @@ def font_dirs():
winutil, err = plugins['winutil']
if err:
raise RuntimeError('Failed to load winutil: %s'%err)
try:
return [winutil.special_folder_path(winutil.CSIDL_FONTS)]
except ValueError:
return [r'C:\Windows\Fonts']
paths = {os.path.normcase(r'C:\Windows\Fonts')}
for which in (winutil.CSIDL_FONTS, winutil.CSIDL_LOCAL_APPDATA, winutil.CSIDL_APPDATA):
try:
path = winutil.special_folder_path(winutil.CSIDL_FONTS)
except ValueError:
continue
if which != winutil.CSIDL_FONTS:
path = os.path.join(path, r'Microsoft\Windows\Fonts')
paths.add(os.path.normcase(path))
return list(paths)
if isosx:
return [
'/Library/Fonts',