-
Notifications
You must be signed in to change notification settings - Fork 1
/
wotmodMaker.py
27 lines (20 loc) · 948 Bytes
/
wotmodMaker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from configLoader import Config
from zipfile import ZipFile
import os
class WotmodMaker:
conf: Config = None
seed = 0
def __init__(self, config: Config, seed):
self.conf = config
self.seed = seed
def create_wotmod(self):
name = self.conf.wotmodName.replace("$randver", self.conf.randomizerversion)\
.replace("$wotver", self.conf.wotversion).replace("$seed", str(self.seed))
wotmod = ZipFile('Output/' + name + '.wotmod', 'w')
for folderName, subfolders, filenames in os.walk(self.conf.resPathOut):
for filename in filenames:
# create complete filepath of file in directory
filePath = os.path.join(folderName, filename)
# Add file to zip
wotmod.write(filePath, arcname=filePath.replace("Output/", ""), compress_type=None, compresslevel=None)
print("Packed wotmod file " + name + ".wotmod")