-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpack.py
37 lines (26 loc) · 1.24 KB
/
pack.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
28
29
30
31
32
33
34
35
36
37
# -=by Cjsah=-
import zipfile, os
# 混淆
# os.system("python garble.py")
# 打包数据包
with zipfile.ZipFile('Slimefunction数据包.zip', 'w', zipfile.ZIP_DEFLATED)as f:
for dir_path, dir_names, filenames in os.walk(os.getcwd() + '/Slimefunction_datapack'):
path = dir_path.replace(os.getcwd() + '/Slimefunction_datapack', '')
path = path and path + os.sep or ''
for filename in filenames:
f.write(os.path.join(dir_path, filename), path + filename)
# 打包资源包
with zipfile.ZipFile('Slimefunction资源包.zip', 'w', zipfile.ZIP_DEFLATED)as f:
for dir_path, dir_names, filenames in os.walk(os.getcwd() + '/Slimefunction_resourcepack'):
path = dir_path.replace(os.getcwd() + '/Slimefunction_resourcepack', '')
path = path and path + os.sep or ''
for filename in filenames:
f.write(os.path.join(dir_path, filename), path + filename)
# 整合打包
name = input('请输入要打包的版本号: ')
with zipfile.ZipFile('Slimefunction-v{}.zip'.format(name), 'w', zipfile.ZIP_DEFLATED)as f:
f.write('Slimefunction数据包.zip')
f.write('Slimefunction资源包.zip')
# 删除残留包
os.remove('Slimefunction数据包.zip')
os.remove('Slimefunction资源包.zip')