Merge pull request #14947 from AUTOMATIC1111/open-button

option "open image button" open the actual dir
This commit is contained in:
AUTOMATIC1111 2024-02-17 21:30:21 +03:00
parent 3345218439
commit cb52279c3e
3 changed files with 51 additions and 17 deletions

View file

@ -81,3 +81,18 @@ def cleanup_tmpdr():
filename = os.path.join(root, name)
os.remove(filename)
def is_gradio_temp_path(path):
"""
Check if the path is a temp dir used by gradio
"""
path = Path(path)
if shared.opts.temp_dir and path.is_relative_to(shared.opts.temp_dir):
return True
if gradio_temp_dir := os.environ.get("GRADIO_TEMP_DIR"):
if path.is_relative_to(gradio_temp_dir):
return True
if path.is_relative_to(Path(tempfile.gettempdir()) / "gradio"):
return True
return False