Add improved file functions.

Add sort in filenames
This commit is contained in:
Andrew 2021-12-21 15:04:32 -05:00
parent 71d3e03875
commit 2afecf8fab

View File

@ -649,9 +649,9 @@ class Helpers:
@staticmethod
def generate_tree(folder, output=""):
for raw_filename in os.listdir(folder):
filename = html.escape(raw_filename)
rel = os.path.join(folder, raw_filename)
for file in sorted(os.scandir(folder), key=lambda e: e.name):
filename = html.escape(file.name)
rel = os.path.join(folder, filename)
if os.path.isdir(rel):
output += \
"""<li class="tree-item" data-path="{}">