-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmkpkg.py
31 lines (29 loc) · 1020 Bytes
/
mkpkg.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
import platform,sys,os.path,os
if platform.python_version_tuple()[0] == "2":
from Steam2.package import Package
import Tkinter, tkFileDialog
tkinter = Tkinter
tkinter.filedialog = tkFileDialog
else:
from Steam2.package3 import Package
import tkinter, tkinter.filedialog
def main():
if len(sys.argv) == 3:
files_dir = os.path.normpath(sys.argv[1])+ "\\"
outfile = sys.argv[2]
else:
files_dir = tkinter.filedialog.askdirectory(title="Select input directory") + "\\"
outfile = tkinter.filedialog.asksaveasfilename(title="Save target PKG file",initialdir=".")
if dir == "" or outfile == "":
exit()
pkg = Package()
listdir = os.listdir(files_dir)
for f in listdir:
if os.path.isfile(files_dir+f):
data = open(files_dir+f,"rb")
pkg.put_file(bytes(f, 'utf-8'),data.read())
data.close()
pkgfile = open(outfile,"wb")
pkgfile.write(pkg.pack())
pkgfile.close()
main()