-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdist-data.py
More file actions
29 lines (25 loc) · 987 Bytes
/
dist-data.py
File metadata and controls
29 lines (25 loc) · 987 Bytes
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
import zipfile, os, json
def ZipDir(DirName, FileName, DontZip: list = []):
FolderPath = os.path.join(os.getcwd(), DirName)
File = zipfile.ZipFile(FileName, "w")
DontZip.append(FileName)
for Root, Dirs, Files in os.walk(FolderPath):
if os.path.basename(Root) in DontZip:
continue
for File2 in Files:
if File2 in DontZip:
continue
FilePath = os.path.join(Root, File2)
File.write(FilePath, os.path.relpath(FilePath, FolderPath))
for Dir in Dirs:
FilePath = os.path.join(Root, Dir, "thereIsSomething")
zipfile.ZipFile(FilePath, "w")
File.write(FilePath, os.path.join(os.path.relpath(FilePath, FolderPath)))
os.system(f'del /s /q "{FilePath}"')
File.close()
filename = f"ModLoaderNew v{json.load(open('dontDeleteMe/assets/info.json',encoding='utf8'))['version']}.zip"
ZipDir(
"dist",
f"dist\\{filename}",
[filename],
)