[+] generic_executor type safety /2

This commit is contained in:
Charles Le Maux 2024-06-15 06:20:33 +02:00
parent 5d9cf5ae5e
commit 7147cc9b88

View File

@ -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)