Optimize .zip size
All checks were successful
SteamWarCI Build successful

This commit is contained in:
2025-06-11 14:11:54 +02:00
parent c6417c74f1
commit 82ba75fae7
18 changed files with 20 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import hashlib
import time
import zipfile
import importlib.util
import json
current_dir = os.getcwd()
@ -58,6 +59,15 @@ def copyFiles(src, dst):
dst_file = os.path.join(dest_path, file)
shutil.copy2(src_file, dst_file) # Overwrites if exists
if dst_file.endswith(".json") or dst_file.endswith(".mcmeta"):
content = ""
with open(dst_file, "r") as file:
content = file.read()
content = json.loads(content)
content = json.dumps(content, separators=(',', ':'))
with open(dst_file, "w") as file:
file.write(content)
def zip_folder(folder_path, zip_file_path):
with zipfile.ZipFile(zip_file_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
for root, dirs, files in os.walk(folder_path):