Use pathclass.glob.

This commit is contained in:
voussoir 2021-09-30 19:02:18 -07:00
parent d36efec25f
commit 2162f1d982
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -1522,9 +1522,8 @@ def addfile_argparse(args):
book = Epub(args.epub) book = Epub(args.epub)
for pattern in args.files: for pattern in args.files:
for file in winglob.glob(pattern): for file in pathclass.glob(pattern, files=True):
print(f'Adding file {file}.') print(f'Adding file {file.absolute_path}.')
file = pathclass.Path(file)
try: try:
book.easy_add_file(file) book.easy_add_file(file)
except (IDExists, FileExists) as exc: except (IDExists, FileExists) as exc:
@ -1624,7 +1623,7 @@ def merge(
): ):
book = Epub.new() book = Epub.new()
input_filepaths = [pathclass.Path(p) for pattern in input_filepaths for p in winglob.glob(pattern)] input_filepaths = list(pathclass.glob_many(input_filepaths))
index_length = len(str(len(input_filepaths))) index_length = len(str(len(input_filepaths)))
rand_prefix = random_string(3, string.digits) rand_prefix = random_string(3, string.digits)