Repository: stable-diffusion-webui
Issue: [Bug]: FileNotFoundError: [Errno 2] No such file or directory
Labels: bug-report

### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

Since months now, it is not possible that WebUI creates directories if needed.
In A1111 there is an option to define a directory for temporay files. In my case this is defined like so: T:\systemp\sd-temp-files
Now, the folder T:\systemp\ is existing. But the folder sd-temp-files will be deleted to remove those temp files. The problme now is: This sd-temp-files folder is not been created if not existing. So, every other function/extension that want to use this, get's an error -> FileNotFoundError: [Errno 2] No such file or directory: 'T:\systemp\sd-temp-files\tmpdycp6gra.png'

So it's an giant urge to tell WebUI it should create directories if they are setup in the settings and not existend.
Hint:
```
import os
path = ...
os.makedirs(path, exist_ok=True)
```

I sincerely hope that someone can finally fix this, thanks.

### Steps to reproduce the problem

1. Useing WebUI

### What should have happened?

Defined temp folders in the settings should be created if not existend.

### Commit where the problem happens

https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/22bcc7be428c94e9408f589966c2040187245d81

### What platforms do you use to access the UI ?

Windows

### What browsers do you use to access the UI ?

Mozilla Firefox

### Command Line Arguments

```Shell
--xformers --api --administrator --opt-split-attention --theme=dark
```


### List of extensions

![extensions](https://user-images.githubusercontent.com/122026301/229884666-bd39a559-c626-410e-99f7-c3a930e1aaef.png)


### Console logs

```Shell
Traceback (most recent call last):███████████████████████████████████████████████████| 110/110 [02:21<00:00,  2.52s/it]
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 394, in run_predict
    output = await app.get_blocks().process_api(
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1078, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1012, in postprocess_data
    prediction_value = block.postprocess(prediction_value)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\components.py", line 3954, in postprocess
    file = processing_utils.save_pil_to_file(img)
  File "I:\Super SD 2.0\stable-diffusion-webui\modules\ui_tempdir.py", line 52, in save_pil_to_file
    file_obj = tempfile.NamedTemporaryFile(delete=False, suffix=".png", dir=dir)
  File "F:\Programme\Python310\lib\tempfile.py", line 559, in NamedTemporaryFile
    file = _io.open(dir, mode, buffering=buffering,
  File "F:\Programme\Python310\lib\tempfile.py", line 556, in opener
    fd, name = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "F:\Programme\Python310\lib\tempfile.py", line 256, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
FileNotFoundError: [Errno 2] No such file or directory: 'T:\\systemp\\sd-temp-files\\tmpdycp6gra.png'
```


### Additional information

This is very URGENT.