From 6abf3dd318d14244e7f66d97fda9d1f776df8c43 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Wed, 26 Oct 2022 16:36:00 +0900 Subject: [PATCH] fix path --- scripts/images_history.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/images_history.py b/scripts/images_history.py index 2688d9b..450818b 100644 --- a/scripts/images_history.py +++ b/scripts/images_history.py @@ -8,6 +8,7 @@ import modules.ui from modules.shared import opts, cmd_opts from modules import shared, scripts from modules import script_callbacks +from pathlib import Path faverate_tab_name = "favorites" tabs_list = ["txt2img", "img2img", "extras", faverate_tab_name, "others"] @@ -183,16 +184,13 @@ def create_tab(tabname): path = f.readline().rstrip("\n") while len(path) > 0: path_recorder.append(path) - path = f.readline().rstrip("\n") + path = f.readline().rstrip("\n") if not custom_dir: - d = dir_name.split("/") - dir_name = "/" if dir_name.startswith("/") else d[0] - for p in d[1:]: - dir_name = os.path.join(dir_name, p) + dir_name = str(Path(dir_name)) if not os.path.exists(dir_name): os.makedirs(dir_name) - + with gr.Row(visible= custom_dir): img_path = gr.Textbox(dir_name, label="Images directory", placeholder="Input images directory", interactive=custom_dir) img_path_history = gr.Dropdown(path_recorder)