mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-04-16 08:33:29 +00:00
Merge branch 'patch-1' of https://github.com/TFWol/ComfyUI
This commit is contained in:
commit
ef5a28b597
@ -138,15 +138,27 @@ def recursive_search(directory, excluded_dir_names=None):
|
|||||||
excluded_dir_names = []
|
excluded_dir_names = []
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
dirs = {directory: os.path.getmtime(directory)}
|
dirs = {}
|
||||||
|
|
||||||
|
# Attempt to add the initial directory to dirs with error handling
|
||||||
|
try:
|
||||||
|
dirs[directory] = os.path.getmtime(directory)
|
||||||
|
except FileNotFoundError:
|
||||||
|
print(f"Warning: Unable to access {directory}. Skipping this path.")
|
||||||
|
|
||||||
for dirpath, subdirs, filenames in os.walk(directory, followlinks=True, topdown=True):
|
for dirpath, subdirs, filenames in os.walk(directory, followlinks=True, topdown=True):
|
||||||
subdirs[:] = [d for d in subdirs if d not in excluded_dir_names]
|
subdirs[:] = [d for d in subdirs if d not in excluded_dir_names]
|
||||||
for file_name in filenames:
|
for file_name in filenames:
|
||||||
relative_path = os.path.relpath(os.path.join(dirpath, file_name), directory)
|
relative_path = os.path.relpath(os.path.join(dirpath, file_name), directory)
|
||||||
result.append(relative_path)
|
result.append(relative_path)
|
||||||
|
|
||||||
for d in subdirs:
|
for d in subdirs:
|
||||||
path = os.path.join(dirpath, d)
|
path = os.path.join(dirpath, d)
|
||||||
dirs[path] = os.path.getmtime(path)
|
try:
|
||||||
|
dirs[path] = os.path.getmtime(path)
|
||||||
|
except FileNotFoundError:
|
||||||
|
print(f"Warning: Unable to access {path}. Skipping this path.")
|
||||||
|
continue
|
||||||
return result, dirs
|
return result, dirs
|
||||||
|
|
||||||
def filter_files_extensions(files, extensions):
|
def filter_files_extensions(files, extensions):
|
||||||
|
Loading…
Reference in New Issue
Block a user