check both cases for directories

master
Tomáš Mládek 2021-09-19 13:47:52 +02:00
parent 405fd3cad5
commit 2647238410
1 changed files with 12 additions and 8 deletions

View File

@ -120,13 +120,17 @@ class KollagenBot:
)
return False
directories = [
(dir, os.path.join(self.base_dir or "./", dir)) for dir in args.directories
]
for orig_dir, full_path in directories:
if not os.path.exists(full_path):
raise FileNotFoundError(f'"{orig_dir}" does not exist.')
directories = []
for dir in args.directories:
for possible in [
os.path.join(self.base_dir or "./", dir),
os.path.join(self.base_dir or "./", dir.upper()),
]:
if os.path.exists(possible):
directories.append(possible)
break
else:
raise FileNotFoundError(f'"{dir}" does not exist.')
mode = ["-m", args.mode] if args.mode else []
num_images = ["-n", str(args.num_images)] if args.num_images else []
@ -135,7 +139,7 @@ class KollagenBot:
shell_cmd_line = [
self.kollagen_path,
"-r",
*[full_path for _, full_path in directories],
*directories,
"-w",
str(args.width),
"-h",