1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2025-01-31 12:27:22 +02:00

font-patcher: Give meaningful error messages on trivial open fails

[why]
When the font file is not existing the message we get is either
unreadable or missleading (at least for normal users).

[how]
Explicitely state why we can not open a font file, at least in the cases
where we can.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2021-11-30 07:58:12 +01:00
parent ab6fa3c562
commit 3384fc302c

View File

@ -51,6 +51,10 @@ class font_patcher:
self.extension = ""
self.setup_arguments()
self.config = configparser.ConfigParser(empty_lines_in_values=False, allow_no_value=True)
if not os.path.isfile(self.args.font):
sys.exit("{}: Font file does not exist: {}".format(projectName, self.args.font))
if not os.access(self.args.font, os.R_OK):
sys.exit("{}: Can not open font file for reading: {}".format(projectName, self.args.font))
try:
self.sourceFont = fontforge.open(self.args.font)
except Exception: