Skip to content

Commit

Permalink
Merge pull request #699 from ryanoasis/feature/enhance-open-error-msg
Browse files Browse the repository at this point in the history
font-patcher: Give meaningful error messages on trivial open fails
  • Loading branch information
ryanoasis authored Dec 5, 2021
2 parents ab6fa3c + 3384fc3 commit bbe2543
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit bbe2543

Please sign in to comment.