diff --git a/comfy/cmd/folder_paths.py b/comfy/cmd/folder_paths.py index 6a79ecad8..3d2e78d7e 100644 --- a/comfy/cmd/folder_paths.py +++ b/comfy/cmd/folder_paths.py @@ -251,9 +251,12 @@ def add_model_folder_path(folder_name, full_folder_path: Optional[str] = None, e """ folder_names_and_paths = _folder_names_and_paths() if full_folder_path is None: - # todo: this should use the subdir pattern - - full_folder_path = os.path.join(_models_dir(), folder_name) + if folder_name not in folder_names_and_paths: + folder_names_and_paths.add(ModelPaths(folder_names=[folder_name], supported_extensions=extensions or _supported_pt_extensions())) + return [p for p in folder_names_and_paths.directory_paths(folder_name)][0] + else: + # todo: this should use the subdir pattern + full_folder_path = construct_path(folder_names_and_paths.base_paths[0]) / "models" / folder_name folder_path = folder_names_and_paths[folder_name] if full_folder_path not in folder_path.paths: @@ -387,6 +390,9 @@ def create_directories(paths: FolderNames | None = None): paths = paths or _folder_names_and_paths() for folder_path_spec in paths.values(): for path in folder_path_spec.paths: + # only create resolved paths + if not Path(path).is_absolute(): + continue os.makedirs(path, exist_ok=True) for path in paths.application_paths: path.mkdir(exist_ok=True, parents=True) diff --git a/comfy/cmd/main.py b/comfy/cmd/main.py index 8bbcd6906..79b20b769 100644 --- a/comfy/cmd/main.py +++ b/comfy/cmd/main.py @@ -151,6 +151,7 @@ async def main(from_script_dir: Optional[Path] = None): # create the default directories if we're instructed to, then exit # or, if it's a windows standalone build, the single .exe file should have its side-by-side directories always created if args.create_directories: + import_all_nodes_in_workspace(raise_on_failure=False) folder_paths.create_directories() return