Skip to content

Commit

Permalink
Display error message when file is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverMendel committed Oct 14, 2024
1 parent dc07149 commit 2f835c3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions heif_convert/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,17 @@ def parse_args():

expanded_input_files = []
for input_file in args.input:
expanded_input_files.extend(glob(input_file))
for input_file in expanded_input_files:
if not os.path.isfile(input_file):
parser.error(f"Input file '{input_file}' does not exist")
if "*" in input_file:
expanded = glob(input_file)
if not expanded:
parser.error(f"No matches found: {input_file}")
else:
expanded_input_files.extend(expanded)
else:
if not os.path.isfile(input_file):
parser.error(f"Input file '{input_file}' does not exist")
else:
expanded_input_files.append(input_file)

args.input = expanded_input_files

Expand Down

0 comments on commit 2f835c3

Please sign in to comment.