34 lines
742 B
Python
Executable File
34 lines
742 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import json
|
|
import os
|
|
from zipfile import ZipFile
|
|
|
|
modFiles = [
|
|
"info.json",
|
|
"changelog.txt",
|
|
"thumbnail.png",
|
|
"LICENSE.md",
|
|
|
|
"data-updates.lua",
|
|
]
|
|
modFolders = [
|
|
]
|
|
|
|
with open("info.json") as file:
|
|
modInfo = json.load(file)
|
|
|
|
mod_name = modInfo["name"]
|
|
mod_version = modInfo["version"]
|
|
zipName = f"{mod_name}_{mod_version}"
|
|
|
|
with ZipFile(f"{zipName}.zip", 'w') as modZip:
|
|
for file in modFiles:
|
|
modZip.write(file, arcname=f"{zipName}/{file}")
|
|
for folder in modFolders:
|
|
for root, dirs, files in os.walk(folder):
|
|
for file in files:
|
|
filePath = os.path.join(root, file)
|
|
archivePath = os.path.relpath(filePath, os.path.join(folder, '..'))
|
|
modZip.write(filePath, arcname=f"{zipName}/{archivePath}")
|