Add error handling to initial fix to keep cache intact

This commit is contained in:
TFWol 2024-01-14 15:06:33 -08:00 committed by GitHub
parent 4ab0392f70
commit 1dab412c79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -139,6 +139,13 @@ def recursive_search(directory, excluded_dir_names=None):
result = []
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):
subdirs[:] = [d for d in subdirs if d not in excluded_dir_names]
for file_name in filenames: