diff --git a/folder_paths.py b/folder_paths.py index 234b73409..4e83b6ffb 100644 --- a/folder_paths.py +++ b/folder_paths.py @@ -126,10 +126,20 @@ def exists_annotated_filepath(name): def add_model_folder_path(folder_name, full_folder_path): global folder_names_and_paths if folder_name in folder_names_and_paths: - folder_names_and_paths[folder_name][0].append(full_folder_path) + subdirs = list_files(full_folder_path) + if len(subdirs) == 0: + folder_names_and_paths[folder_name][0].append(full_folder_path) + else: + for subdir in subdirs: + folder_names_and_paths[folder_name][0].append(subdir) + else: folder_names_and_paths[folder_name] = ([full_folder_path], set()) +def list_files(dir): + r = [] + return [x[0] for x in os.walk(dir)] + def get_folder_paths(folder_name): return folder_names_and_paths[folder_name][0][:] diff --git a/main.py b/main.py index a374f2b12..719b4f9bc 100644 --- a/main.py +++ b/main.py @@ -184,6 +184,8 @@ def load_extra_path_config(yaml_path): if base_path is not None: full_path = os.path.join(base_path, full_path) logging.info("Adding extra search path {} {}".format(x, full_path)) + full_path = full_path.replace("\\", "\\") + full_path = full_path.replace("\\", "/") folder_paths.add_model_folder_path(x, full_path)