changed linux font directory to ~/.local/share/fonts/ #340

This commit is contained in:
TomSchimansky 2022-09-15 12:31:43 +02:00
parent 64c8b8345d
commit 65c45abe32

View File

@ -6,13 +6,15 @@ from typing import Union
class FontManager: class FontManager:
linux_font_path = "~/.local/share/fonts/"
@classmethod @classmethod
def init_font_manager(cls): def init_font_manager(cls):
# Linux # Linux
if sys.platform.startswith("linux"): if sys.platform.startswith("linux"):
try: try:
if not os.path.isdir(os.path.expanduser('~/.fonts/')): if not os.path.isdir(os.path.expanduser(cls.linux_font_path)):
os.mkdir(os.path.expanduser('~/.fonts/')) os.mkdir(os.path.expanduser(cls.linux_font_path))
return True return True
except Exception as err: except Exception as err:
sys.stderr.write("FontManager error: " + str(err) + "\n") sys.stderr.write("FontManager error: " + str(err) + "\n")
@ -53,7 +55,7 @@ class FontManager:
# Linux # Linux
elif sys.platform.startswith("linux"): elif sys.platform.startswith("linux"):
try: try:
shutil.copy(font_path, os.path.expanduser("~/.fonts/")) shutil.copy(font_path, os.path.expanduser(cls.linux_font_path))
return True return True
except Exception as err: except Exception as err:
sys.stderr.write("FontManager error: " + str(err) + "\n") sys.stderr.write("FontManager error: " + str(err) + "\n")