Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions comfy/cli_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __call__(self, parser, namespace, values, option_string=None):
parser.add_argument("--output-directory", type=str, default=None, help="Set the ComfyUI output directory. Overrides --base-directory.")
parser.add_argument("--temp-directory", type=str, default=None, help="Set the ComfyUI temp directory (default is in the ComfyUI directory). Overrides --base-directory.")
parser.add_argument("--input-directory", type=str, default=None, help="Set the ComfyUI input directory. Overrides --base-directory.")
parser.add_argument("--custom-nodes-directory", type=str, default=None, help="Set the ComfyUI custom_nodes directory. Overrides --base-directory.")
parser.add_argument("--auto-launch", action="store_true", help="Automatically launch ComfyUI in the default browser.")
parser.add_argument("--disable-auto-launch", action="store_true", help="Disable auto launching the browser.")
parser.add_argument("--cuda-device", type=int, default=None, metavar="DEVICE_ID", help="Set the id of the cuda device this instance will use. All other devices will not be visible.")
Expand Down
11 changes: 11 additions & 0 deletions folder_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import time
import mimetypes
import logging
import sys
from typing import Literal, List
from collections.abc import Collection

Expand Down Expand Up @@ -117,6 +118,16 @@ def set_input_directory(input_dir: str) -> None:
global input_directory
input_directory = input_dir

def set_custom_nodes_directory(custom_nodes_dir: str) -> None:
global folder_names_and_paths

delimiter = ":"
if sys.platform in ("win32", "cygwin"):
delimiter = ";"

directories = custom_nodes_dir.split(delimiter)
folder_names_and_paths["custom_nodes"] = (directories, set())

def get_output_directory() -> str:
global output_directory
return output_directory
Expand Down
7 changes: 6 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def apply_custom_paths():
for config_path in itertools.chain(*args.extra_model_paths_config):
utils.extra_config.load_extra_path_config(config_path)

# --output-directory, --input-directory, --user-directory
# --output-directory, --input-directory, --user-directory, --custom-nodes-directory
if args.output_directory:
output_dir = os.path.abspath(args.output_directory)
logging.info(f"Setting output directory to: {output_dir}")
Expand All @@ -56,6 +56,11 @@ def apply_custom_paths():
logging.info(f"Setting user directory to: {user_dir}")
folder_paths.set_user_directory(user_dir)

if args.custom_nodes_directory:
custom_nodes_dir = os.path.abspath(args.custom_nodes_directory)
logging.info(f"Setting custom nodes directory to: {custom_nodes_dir}")
folder_paths.set_custom_nodes_directory(custom_nodes_dir)


def execute_prestartup_script():
if args.disable_all_custom_nodes and len(args.whitelist_custom_nodes) == 0:
Expand Down