restore ability to save files to directories named after prompt (#654)

This commit is contained in:
Lincoln Stein
2022-09-18 08:37:08 -04:00
committed by GitHub
parent 9bcb0dff96
commit b68cb521ba
2 changed files with 5 additions and 5 deletions

View File

@ -191,11 +191,7 @@ def main_loop(gen, opt, infile):
else:
opt.with_variations = None
if opt.outdir:
if not os.path.exists(opt.outdir):
os.makedirs(opt.outdir)
current_outdir = opt.outdir
elif opt.prompt_as_dir:
if opt.prompt_as_dir:
# sanitize the prompt to a valid folder name
subdir = path_filter.sub('_', opt.prompt)[:name_max].rstrip(' .')
@ -210,6 +206,8 @@ def main_loop(gen, opt, infile):
if not os.path.exists(current_outdir):
os.makedirs(current_outdir)
else:
if not os.path.exists(opt.outdir):
os.makedirs(opt.outdir)
current_outdir = opt.outdir
# Here is where the images are actually generated!