1
0
Fork 0
forked from josch/img2pdf
img2pdf/src
Paul Ingemi 505344f83e
Add Windows support for paths containing wildcards "*" and "?"
Img2pdf accepts paths containing wildcards such as *.jpg to efficiently refer
to multiple input files that match the wildcard expression. Under POSIX
environments the command line shell is expected to perform this expansion,
however Windows requires the command line utility itself to expand the
wildcard expression.

Ideally this would be performed by argparse as described in this draft PEP:
https://mail.python.org/pipermail/python-ideas/2015-August/035244.html

Since argparse doesn't do it, this commit performs expansion directly.

Some implementation notes:
 - Wildcard characters "*" and "?" are not valid in Windows filenames
 - Code doesn't support bracket wildcards such as [0-3] on Windows since
   they are valid filename characters
 - Due to expansion, the images list collected by argparse may contain
   sub-lists. Code uses chain.from_iterable to create a flat list.
 - Paths that refer to non-existant files raise an error message, while
   wildcards that match no files are silently ignored.
2020-10-05 10:28:08 +02:00
..
tests remove obsolete src/tests/__init__.py 2020-08-03 14:56:32 +02:00
img2pdf.py Add Windows support for paths containing wildcards "*" and "?" 2020-10-05 10:28:08 +02:00
img2pdf_test.py src/img2pdf_test.py: we create our own channel-switching ICC profile 2020-08-09 22:03:47 +02:00
jp2.py reformat with black 2020-08-05 08:13:52 +02:00