mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 08:12:33 +03:00
default to using /usr/share when XDG_DATA_DIRS is empty or unset
This commit is contained in:
parent
ee7b15c924
commit
1c6a89e4c2
|
@ -252,7 +252,12 @@ def truetype(font=None, size=10, index=0, encoding="", filename=None):
|
||||||
filename = os.path.join(windir, "fonts", font)
|
filename = os.path.join(windir, "fonts", font)
|
||||||
return FreeTypeFont(filename, size, index, encoding)
|
return FreeTypeFont(filename, size, index, encoding)
|
||||||
elif sys.platform in ('linux', 'linux2'):
|
elif sys.platform in ('linux', 'linux2'):
|
||||||
lindirs = os.environ.get("XDG_DATA_DIRS", "").split(":")
|
lindirs = os.environ.get("XDG_DATA_DIRS", "")
|
||||||
|
if not lindirs:
|
||||||
|
#According to the freedesktop spec, XDG_DATA_DIRS should
|
||||||
|
#default to /usr/share
|
||||||
|
lindirs = '/usr/share'
|
||||||
|
lindirs = lindirs.split(":")
|
||||||
for lindir in lindirs:
|
for lindir in lindirs:
|
||||||
parentpath = os.path.join(lindir, "fonts")
|
parentpath = os.path.join(lindir, "fonts")
|
||||||
for walkroot, walkdir, walkfilenames in os.walk(parentpath):
|
for walkroot, walkdir, walkfilenames in os.walk(parentpath):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user