sm64coopdx/tools/mkzip.py
fgsfds 4feacc0065 add virtual filesystem thing w/ ZIP support
similar to Quake 3: all the archives and folders get mounted to the same mountpoint in the VFS, read access to files in the VFS is transparent
2020-06-07 21:06:25 +03:00

22 lines
501 B
Python

#!/usr/bin/env python3
import sys
import os
import zipfile
if len(sys.argv) < 3:
print('usage: mkzip <lstfile> <zipfile>')
sys.exit(1)
lst = []
with open(sys.argv[1], 'r') as f:
for line in f:
line = line.strip()
if line == '' or line[0] == '#':
continue
tok = line.split()
lst.append((tok[0], tok[1]))
with zipfile.ZipFile(sys.argv[2], 'w', allowZip64=False) as zipf:
for (fname, aname) in lst:
zipf.write(fname, arcname=aname)