Creating all known paths now correctly creates paths for custom nodes' models

This commit is contained in:
doctorpangloss 2024-12-05 14:11:41 -08:00
parent b1ad9cad37
commit 8c0ece1b8c
2 changed files with 10 additions and 3 deletions

View File

@ -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)

View File

@ -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