mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-18 13:07:28 +08:00
Merge 02064cb6e5 into 639f631a08
This commit is contained in:
commit
ad0f91321d
@ -117,10 +117,27 @@ class ModelFileManager:
|
||||
# TODO use settings
|
||||
include_hidden_files = False
|
||||
|
||||
# Check if we should skip following symlinks
|
||||
from comfy.cli_args import args
|
||||
skip_symlinks = getattr(args, 'skip_symlink_scan', False)
|
||||
followlinks = not skip_symlinks
|
||||
|
||||
result: list[str] = []
|
||||
dirs: dict[str, float] = {}
|
||||
|
||||
for dirpath, subdirs, filenames in os.walk(directory, followlinks=True, topdown=True):
|
||||
for dirpath, subdirs, filenames in os.walk(directory, followlinks=followlinks, topdown=True):
|
||||
# If skipping symlinks, filter out symlinked directories
|
||||
if skip_symlinks:
|
||||
filtered_subdirs = []
|
||||
for d in subdirs:
|
||||
subdir_path = os.path.join(dirpath, d)
|
||||
# Check if it's a symlink
|
||||
if os.path.islink(subdir_path):
|
||||
logging.debug(f"Skipping symlink: {subdir_path}")
|
||||
continue
|
||||
filtered_subdirs.append(d)
|
||||
subdirs[:] = filtered_subdirs
|
||||
|
||||
subdirs[:] = [d for d in subdirs if d not in excluded_dir_names]
|
||||
if not include_hidden_files:
|
||||
subdirs[:] = [d for d in subdirs if not d.startswith(".")]
|
||||
|
||||
@ -241,6 +241,8 @@ parser.add_argument("--enable-assets", action="store_true", help="Enable the ass
|
||||
parser.add_argument("--feature-flag", type=str, action='append', default=[], metavar="KEY[=VALUE]", help="Set a server feature flag. Use KEY=VALUE to set an explicit value, or bare KEY to set it to true. Can be specified multiple times. Boolean values (true/false) and numbers are auto-converted. Examples: --feature-flag show_signin_button=true or --feature-flag show_signin_button")
|
||||
parser.add_argument("--list-feature-flags", action="store_true", help="Print the registry of known CLI-settable feature flags as JSON and exit.")
|
||||
|
||||
parser.add_argument("--skip-symlink-scan", action="store_true", help="Skip following symlinks when scanning directories. Useful when symlinks point to network paths with many files. Specifying a filename directly will still work.")
|
||||
|
||||
if comfy.options.args_parsing:
|
||||
args = parser.parse_args()
|
||||
else:
|
||||
|
||||
@ -309,6 +309,10 @@ def recursive_search(directory: str, excluded_dir_names: list[str] | None=None)
|
||||
if excluded_dir_names is None:
|
||||
excluded_dir_names = []
|
||||
|
||||
# Check if we should skip following symlinks
|
||||
skip_symlinks = getattr(args, 'skip_symlink_scan', False)
|
||||
followlinks = not skip_symlinks
|
||||
|
||||
result = []
|
||||
dirs = {}
|
||||
|
||||
@ -323,7 +327,19 @@ def recursive_search(directory: str, excluded_dir_names: list[str] | None=None)
|
||||
subdirs: list[str]
|
||||
filenames: list[str]
|
||||
|
||||
for dirpath, subdirs, filenames in os.walk(directory, followlinks=True, topdown=True):
|
||||
for dirpath, subdirs, filenames in os.walk(directory, followlinks=followlinks, topdown=True):
|
||||
# If skipping symlinks, filter out symlinked directories
|
||||
if skip_symlinks:
|
||||
filtered_subdirs = []
|
||||
for d in subdirs:
|
||||
subdir_path = os.path.join(dirpath, d)
|
||||
# Check if it's a symlink
|
||||
if os.path.islink(subdir_path):
|
||||
logging.debug(f"Skipping symlink: {subdir_path}")
|
||||
continue
|
||||
filtered_subdirs.append(d)
|
||||
subdirs[:] = filtered_subdirs
|
||||
|
||||
subdirs[:] = [d for d in subdirs if d not in excluded_dir_names]
|
||||
for file_name in filenames:
|
||||
try:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user