def installZipFile(data, fname):
base = os.path.join(defaultBase(),'addons')
if fname.endswith(".py"):
path = os.path.join(base, fname)
open(path, "wb").write(data)
return True
# .zip file
try:
z = zipfile.ZipFile(io.BytesIO(data))
except zipfile.BadZipfile:
return False
for n in z.namelist():
if n.endswith("/"):
# folder; ignore
continue
# write
z.extract(n, base)
return True
评论列表
文章目录