From e1aa797e11a681f241310da53295d6b8199a928a Mon Sep 17 00:00:00 2001 From: Juga Paazmaya Date: Mon, 21 Sep 2026 15:14:23 +0300 Subject: [PATCH] Handle custom user directory path --- llada_gguf_adapter.py | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/llada_gguf_adapter.py b/llada_gguf_adapter.py index ff82953..1adee5c 100644 --- a/llada_gguf_adapter.py +++ b/llada_gguf_adapter.py @@ -30,17 +30,30 @@ def _load_city96_modules(): importlib.import_module(alias + ".ops"), ) - comfy_root = Path(folder_paths.__file__).resolve().parent - custom_nodes = comfy_root / "custom_nodes" - + custom_node_dirs = [] + base_path_custom_nodes = getattr(folder_paths, "folder_names_and_paths", {}).get("custom_nodes") + if base_path_custom_nodes: + custom_node_dirs.extend(Path(p) for p in base_path_custom_nodes[0]) + base_path = getattr(folder_paths, "base_path", None) + if base_path: + custom_node_dirs.append(Path(base_path) / "custom_nodes") + # Fall back to the ComfyUI install directory in case base_path isn't set. + custom_node_dirs.append(Path(folder_paths.__file__).resolve().parent / "custom_nodes") + + seen = set() candidates = [] - for p in custom_nodes.iterdir() if custom_nodes.is_dir() else []: - if not p.is_dir(): + for custom_nodes in custom_node_dirs: + custom_nodes = custom_nodes.resolve() if custom_nodes.is_dir() else custom_nodes + if custom_nodes in seen or not custom_nodes.is_dir(): continue - if (p / "loader.py").is_file() and (p / "dequant.py").is_file() and (p / "ops.py").is_file(): - name = p.name.lower().replace("_", "-") - if "gguf" in name: - candidates.append(p) + seen.add(custom_nodes) + for p in custom_nodes.iterdir(): + if not p.is_dir(): + continue + if (p / "loader.py").is_file() and (p / "dequant.py").is_file() and (p / "ops.py").is_file(): + name = p.name.lower().replace("_", "-") + if "gguf" in name: + candidates.append(p) # Prefer the canonical City96 folder if present. candidates.sort(key=lambda p: (0 if p.name.lower() == "comfyui-gguf" else 1, p.name.lower()))