stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

Make sure folder exists before saving image

Open notscuffed opened this issue 3 years ago • 3 comments

Solves an issue where output image preview stops working after user accidentally deletes the temporary folder.

notscuffed avatar Oct 20 '22 18:10 notscuffed

Use os.makedirs(dir, exist_ok=True) then you don't need 5 lines of code and it will work when intermediate-level directories are missing

CookieHCl avatar Oct 20 '22 19:10 CookieHCl

I am aware of os.makedirs but chose to use os.mkdir in case the function receives a bad path so it doesn't create a bunch of unwanted folders somewhere on the users pc.

notscuffed avatar Oct 20 '22 20:10 notscuffed

when would it receive a bad path

AUTOMATIC1111 avatar Oct 22 '22 17:10 AUTOMATIC1111