diff --git a/app/classes/minecraft/stats.py b/app/classes/minecraft/stats.py index e5411107..da5b725e 100644 --- a/app/classes/minecraft/stats.py +++ b/app/classes/minecraft/stats.py @@ -314,7 +314,8 @@ class Stats: # get our server object, settings and data dictionaries server_obj = self.controller.get_server_obj(server_id) - server_obj.reload_server_settings() + if server_obj: + server_obj.reload_server_settings() server_settings = self.controller.get_server_settings(server_id) server_data = self.controller.get_server_data(server_id) diff --git a/app/classes/shared/helpers.py b/app/classes/shared/helpers.py index 7cedc545..d9877f90 100644 --- a/app/classes/shared/helpers.py +++ b/app/classes/shared/helpers.py @@ -652,8 +652,15 @@ class Helpers: @staticmethod def generate_tree(folder, output=""): + dir_list = [] + unsorted_files = [] file_list = os.listdir(folder) - file_list = sorted(file_list, key=str.casefold) + for item in file_list: + if os.path.isdir(os.path.join(folder, item)): + dir_list.append(item) + else: + unsorted_files.append(item) + file_list = sorted(dir_list, key=str.casefold) + sorted(unsorted_files, key=str.casefold) for raw_filename in file_list: filename = html.escape(raw_filename) rel = os.path.join(folder, raw_filename) @@ -673,7 +680,7 @@ class Helpers: else: if filename != "crafty_managed.txt": output += f"""
  • {filename}
  • """ @@ -681,8 +688,15 @@ class Helpers: @staticmethod def generate_dir(folder, output=""): + dir_list = [] + unsorted_files = [] file_list = os.listdir(folder) - file_list = sorted(file_list, key=str.casefold) + for item in file_list: + if os.path.isdir(os.path.join(folder, item)): + dir_list.append(item) + else: + unsorted_files.append(item) + file_list = sorted(dir_list, key=str.casefold) + sorted(unsorted_files, key=str.casefold) output += \ f"""