diff --git a/file_manager.py b/file_manager.py index 7d6e160..663f4a9 100644 --- a/file_manager.py +++ b/file_manager.py @@ -2,6 +2,17 @@ import os import shutil import re +supported_versions = ["bukkit", "paper", "spigot"] + +def get_all_versions(folder_path="servers/paper"): + return [name for name in os.listdir(folder_path) if os.path.isdir(os.path.join(folder_path, name))] + +def version_exists(version, framework = "paper")->bool: + if framework not in supported_versions: + return False + folder_names = get_all_versions("servers/"+framework) + return any(version in name for name in folder_names) + def create_folder(path): os.makedirs(path, exist_ok=True)