mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 18:36:17 +03:00
Merge pull request #1 from radarhere/improved-xdg-dirs-support
Rearranged code
This commit is contained in:
commit
d50c9cc700
|
@ -848,13 +848,15 @@ def truetype(
|
||||||
# when XDG_DATA_HOME is unset or empty. This user-level directory
|
# when XDG_DATA_HOME is unset or empty. This user-level directory
|
||||||
# takes precedence over system-level directories.
|
# takes precedence over system-level directories.
|
||||||
data_home = os.path.expanduser("~/.local/share")
|
data_home = os.path.expanduser("~/.local/share")
|
||||||
dirs.append(os.path.join(data_home, "fonts"))
|
xdg_dirs = [data_home]
|
||||||
|
|
||||||
data_dirs = os.environ.get("XDG_DATA_DIRS")
|
data_dirs = os.environ.get("XDG_DATA_DIRS")
|
||||||
if not data_dirs:
|
if not data_dirs:
|
||||||
# Similarly, defaults are defined for the system-level directories
|
# Similarly, defaults are defined for the system-level directories
|
||||||
data_dirs = "/usr/local/share:/usr/share"
|
data_dirs = "/usr/local/share:/usr/share"
|
||||||
dirs += [os.path.join(ddir, "fonts") for ddir in data_dirs.split(":")]
|
xdg_dirs += data_dirs.split(":")
|
||||||
|
|
||||||
|
dirs += [os.path.join(xdg_dir, "fonts") for xdg_dir in xdg_dirs]
|
||||||
elif sys.platform == "darwin":
|
elif sys.platform == "darwin":
|
||||||
dirs += [
|
dirs += [
|
||||||
"/Library/Fonts",
|
"/Library/Fonts",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user