Merge pull request #15446 from AUTOMATIC1111/re-add-update_file_entry

re-add update_file_entry
This commit is contained in:
AUTOMATIC1111 2024-04-06 10:02:45 +03:00 committed by GitHub
commit c16a27caa9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -148,6 +148,11 @@ class MassFileLister:
"""Clear the cache of all directories."""
self.cached_dirs.clear()
def update_file_entry(self, path):
"""Update the cache for a specific directory."""
dirname, filename = os.path.split(path)
if cached_dir := self.cached_dirs.get(dirname):
cached_dir.update_entry(filename)
def topological_sort(dependencies):
"""Accepts a dictionary mapping name to its dependencies, returns a list of names ordered according to dependencies.