use natural sort for shared.walk_files and shared.listfiles, as well as for dirs in extra networks

This commit is contained in:
AUTOMATIC1111
2023-07-08 16:45:59 +03:00
parent 7a6abc59ea
commit d7d6e8cfc8
3 changed files with 14 additions and 6 deletions

View File

@@ -90,8 +90,8 @@ class ExtraNetworksPage:
subdirs = {}
for parentdir in [os.path.abspath(x) for x in self.allowed_directories_for_previews()]:
for root, dirs, _ in os.walk(parentdir, followlinks=True):
for dirname in dirs:
for root, dirs, _ in sorted(os.walk(parentdir, followlinks=True), key=lambda x: shared.natural_sort_key(x[0])):
for dirname in sorted(dirs, key=shared.natural_sort_key):
x = os.path.join(root, dirname)
if not os.path.isdir(x):