From 2f6798c1510af17fcc8fde8037799bb6c9c51d56 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Tue, 28 Jan 2025 23:35:12 +1100 Subject: [PATCH] Reimpl. CLI arg directly inside folder_paths. --- folder_paths.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/folder_paths.py b/folder_paths.py index 616a0d6a5..4344fb187 100644 --- a/folder_paths.py +++ b/folder_paths.py @@ -7,11 +7,19 @@ import logging from typing import Literal from collections.abc import Collection +from comfy.cli_args import args + supported_pt_extensions: set[str] = {'.ckpt', '.pt', '.bin', '.pth', '.safetensors', '.pkl', '.sft'} folder_names_and_paths: dict[str, tuple[list[str], set[str]]] = {} -base_path = os.path.dirname(os.path.realpath(__file__)) +# --base-directory - Resets all default paths configured in folder_paths with a new base path +if args.base_directory: + base_path = os.path.abspath(args.base_directory) + logging.info(f"Setting base directory to: {base_path}") +else: + base_path = os.path.dirname(os.path.realpath(__file__)) + models_dir = os.path.join(base_path, "models") folder_names_and_paths["checkpoints"] = ([os.path.join(models_dir, "checkpoints")], supported_pt_extensions) folder_names_and_paths["configs"] = ([os.path.join(models_dir, "configs")], [".yaml"])