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